Class AMQPHeader
- java.lang.Object
-
- org.apache.qpid.protonj2.types.transport.AMQPHeader
-
public final class AMQPHeader extends java.lang.ObjectRepresents 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 interfaceAMQPHeader.HeaderHandler<E>
-
Field Summary
Fields Modifier and Type Field Description static byteAMQP_PROTOCOL_IDstatic intHEADER_SIZE_BYTESstatic intMAJOR_VERSION_INDEXstatic intMINOR_VERSION_INDEXstatic intPROTOCOL_ID_INDEXstatic intREVISION_INDEXstatic byteSASL_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 booleanequals(java.lang.Object obj)static AMQPHeadergetAMQPHeader()ProtonBuffergetBuffer()bytegetByteAt(int i)intgetMajor()intgetMinor()intgetProtocolId()intgetRevision()static AMQPHeadergetSASLHeader()inthashCode()booleanhasValidPrefix()<E> voidinvoke(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.booleanisSaslHeader()byte[]toArray()java.nio.ByteBuffertoByteBuffer()java.lang.StringtoString()static voidvalidateByte(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 anIndexOutOfBoundsExceptionwill 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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 anIndexOutOfBoundsExceptionwill 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.HeaderHandlerinstance to use to process the header.context- A context object to pass along with the header.
-
-