Class AMQPHeader
java.lang.Object
org.apache.qpid.protonj2.types.transport.AMQPHeader
Represents the AMQP protocol handshake packet that is sent during the
initial exchange with a remote peer.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte
static final int
static final int
static final int
static final int
static final int
static final byte
-
Constructor Summary
ConstructorDescriptionAMQPHeader
(byte[] headerBytes) AMQPHeader
(ProtonBuffer buffer) AMQPHeader
(ProtonBuffer buffer, boolean validate) -
Method Summary
Modifier and TypeMethodDescriptionboolean
static AMQPHeader
byte
getByteAt
(int i) int
getMajor()
int
getMinor()
int
int
static AMQPHeader
int
hashCode()
boolean
<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
byte[]
toArray()
toString()
static void
validate
(byte[] headerBytes) Validates that the bytes contained in the given array are a valid AMQP header.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 Details
-
PROTOCOL_ID_INDEX
public static final int PROTOCOL_ID_INDEX- See Also:
-
MAJOR_VERSION_INDEX
public static final int MAJOR_VERSION_INDEX- See Also:
-
MINOR_VERSION_INDEX
public static final int MINOR_VERSION_INDEX- See Also:
-
REVISION_INDEX
public static final int REVISION_INDEX- See Also:
-
AMQP_PROTOCOL_ID
public static final byte AMQP_PROTOCOL_ID- See Also:
-
SASL_PROTOCOL_ID
public static final byte SASL_PROTOCOL_ID- See Also:
-
HEADER_SIZE_BYTES
public static final int HEADER_SIZE_BYTES- See Also:
-
-
Constructor Details
-
AMQPHeader
public AMQPHeader() -
AMQPHeader
public AMQPHeader(byte[] headerBytes) -
AMQPHeader
-
AMQPHeader
-
-
Method Details
-
getAMQPHeader
-
getSASLHeader
-
getProtocolId
public int getProtocolId() -
getMajor
public int getMajor() -
getMinor
public int getMinor() -
getRevision
public int getRevision() -
getBuffer
-
toArray
public byte[] toArray() -
toByteBuffer
-
getByteAt
public byte getByteAt(int i) -
hasValidPrefix
public boolean hasValidPrefix() -
isSaslHeader
public boolean isSaslHeader() -
hashCode
public int hashCode() -
equals
-
toString
-
validate
public static void validate(byte[] headerBytes) Validates that the bytes contained in the given array are a valid AMQP header.- Parameters:
headerBytes
- The bytes to validate.
-
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:
IllegalArgumentException
- if the value is not valid for the index given in the AMQP headerIndexOutOfBoundsException
- if the index value is greater than the AMQP header size.
-
invoke
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.
-