Class AMQPHeader

java.lang.Object
org.apache.qpid.protonj2.types.transport.AMQPHeader

public final class AMQPHeader extends Object
Represents the AMQP protocol handshake packet that is sent during the initial exchange with a remote peer.
  • Field Details

  • Constructor Details

    • AMQPHeader

      public AMQPHeader()
    • AMQPHeader

      public AMQPHeader(byte[] headerBytes)
    • AMQPHeader

      public AMQPHeader(ProtonBuffer buffer)
    • AMQPHeader

      public AMQPHeader(ProtonBuffer buffer, boolean validate)
  • Method Details

    • 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 ByteBuffer toByteBuffer()
    • getByteAt

      public byte getByteAt(int i)
    • hasValidPrefix

      public boolean hasValidPrefix()
    • isSaslHeader

      public boolean isSaslHeader()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 an IndexOutOfBoundsException 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 header
      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 - The AMQPHeader.HeaderHandler instance to use to process the header.
      context - A context object to pass along with the header.