Class AMQPHeader
- java.lang.Object
-
- org.apache.qpid.protonj2.types.transport.AMQPHeader
-
public final class AMQPHeader extends java.lang.Object
Represents the AMQP protocol handshake packet that is sent during the initial exchange with a remote peer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AMQPHeader.HeaderHandler<E>
-
Field Summary
Fields Modifier and Type Field Description static byte
AMQP_PROTOCOL_ID
static int
HEADER_SIZE_BYTES
static int
MAJOR_VERSION_INDEX
static int
MINOR_VERSION_INDEX
static int
PROTOCOL_ID_INDEX
static int
REVISION_INDEX
static byte
SASL_PROTOCOL_ID
-
Constructor Summary
Constructors Constructor Description AMQPHeader()
AMQPHeader(byte[] headerBytes)
AMQPHeader(ProtonBuffer buffer)
AMQPHeader(ProtonBuffer buffer, boolean validate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
static AMQPHeader
getAMQPHeader()
ProtonBuffer
getBuffer()
byte
getByteAt(int i)
int
getMajor()
int
getMinor()
int
getProtocolId()
int
getRevision()
static AMQPHeader
getSASLHeader()
int
hashCode()
boolean
hasValidPrefix()
<E> void
invoke(AMQPHeader.HeaderHandler<E> handler, E context)
Provide this AMQP Header with a handler that will process the given AMQP header depending on the protocol type the correct handler method is invoked.boolean
isSaslHeader()
byte[]
toArray()
java.nio.ByteBuffer
toByteBuffer()
java.lang.String
toString()
static void
validateByte(int index, byte value)
Called to validate a byte according to a given index within the AMQP Header If the index is outside the range of the header size anIndexOutOfBoundsException
will be thrown.
-
-
-
Field Detail
-
PROTOCOL_ID_INDEX
public static final int PROTOCOL_ID_INDEX
- See Also:
- Constant Field Values
-
MAJOR_VERSION_INDEX
public static final int MAJOR_VERSION_INDEX
- See Also:
- Constant Field Values
-
MINOR_VERSION_INDEX
public static final int MINOR_VERSION_INDEX
- See Also:
- Constant Field Values
-
REVISION_INDEX
public static final int REVISION_INDEX
- See Also:
- Constant Field Values
-
AMQP_PROTOCOL_ID
public static final byte AMQP_PROTOCOL_ID
- See Also:
- Constant Field Values
-
SASL_PROTOCOL_ID
public static final byte SASL_PROTOCOL_ID
- See Also:
- Constant Field Values
-
HEADER_SIZE_BYTES
public static final int HEADER_SIZE_BYTES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AMQPHeader
public AMQPHeader()
-
AMQPHeader
public AMQPHeader(byte[] headerBytes)
-
AMQPHeader
public AMQPHeader(ProtonBuffer buffer)
-
AMQPHeader
public AMQPHeader(ProtonBuffer buffer, boolean validate)
-
-
Method Detail
-
getAMQPHeader
public static AMQPHeader getAMQPHeader()
-
getSASLHeader
public static AMQPHeader getSASLHeader()
-
getProtocolId
public int getProtocolId()
-
getMajor
public int getMajor()
-
getMinor
public int getMinor()
-
getRevision
public int getRevision()
-
getBuffer
public ProtonBuffer getBuffer()
-
toArray
public byte[] toArray()
-
toByteBuffer
public java.nio.ByteBuffer toByteBuffer()
-
getByteAt
public byte getByteAt(int i)
-
hasValidPrefix
public boolean hasValidPrefix()
-
isSaslHeader
public boolean isSaslHeader()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
validateByte
public static void validateByte(int index, byte value)
Called to validate a byte according to a given index within the AMQP Header If the index is outside the range of the header size anIndexOutOfBoundsException
will be thrown.- Parameters:
index
- The index in the header where the byte should be validated.value
- The value to check validity of in the given index in the AMQP Header.- Throws:
java.lang.IllegalArgumentException
- if the value is not valid for the index given in the AMQP headerjava.lang.IndexOutOfBoundsException
- if the index value is greater than the AMQP header size.
-
invoke
public <E> void invoke(AMQPHeader.HeaderHandler<E> handler, E context)
Provide this AMQP Header with a handler that will process the given AMQP header depending on the protocol type the correct handler method is invoked.- Type Parameters:
E
- The type that will be passed as the context for this event- Parameters:
handler
- TheAMQPHeader.HeaderHandler
instance to use to process the header.context
- A context object to pass along with the header.
-
-