Class Frame

java.lang.Object
com.rabbitmq.client.impl.Frame

public class Frame extends Object
Represents an AMQP wire-protocol frame, with frame type, channel number, and payload bytes. TODO: make state private
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final ByteArrayOutputStream
    Frame payload (for outbound frames)
    final int
    Frame channel number, 0-65535
    private static final int
     
    private final byte[]
    Frame payload bytes (for inbound frames)
    final int
    Frame type code
  • Constructor Summary

    Constructors
    Constructor
    Description
    Frame(int type, int channel)
    Constructs a frame for output with a type and a channel number and a fresh accumulator waiting for payload.
    Frame(int type, int channel, byte[] payload)
    Constructs a frame for input with a type, a channel number and a payload byte array.
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    arraySize(Object[] values)
    Computes the AMQP wire-protocol length of an encoded field-array of type Object[]
    static long
    arraySize(List<?> values)
    Computes the AMQP 0-9-1 wire-protocol length of an encoded field-array of type List
    private static long
    Computes the AMQP wire-protocol length of a protocol-encoded field-value.
    static Frame
    fromBodyFragment(int channelNumber, byte[] body, int offset, int length)
     
    Public API - retrieves a new DataInputStream streaming over the payload
    Public API - retrieves a fresh DataOutputStream streaming into the accumulator
    byte[]
    Public API - retrieves the frame payload
    private static int
    Computes the AMQP wire-protocol length of a protocol-encoded long string.
    static void
    Private API - A protocol version mismatch is detected by checking the three next bytes if a frame type of (int)'A' is read from an input stream.
    static Frame
    readFrom(DataInputStream is, int maxPayloadSize)
    Protected API - Factory method to instantiate a Frame by reading an AMQP-wire-protocol frame from the given input stream.
    private static int
    Computes the AMQP wire-protocol length of a protocol-encoded short string.
    int
     
    static long
    Computes the AMQP wire-protocol length of protocol-encoded table entries.
     
    void
    Public API - writes this Frame to the given DataOutputStream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • type

      public final int type
      Frame type code
    • channel

      public final int channel
      Frame channel number, 0-65535
    • payload

      private final byte[] payload
      Frame payload bytes (for inbound frames)
    • accumulator

      private final ByteArrayOutputStream accumulator
      Frame payload (for outbound frames)
    • NON_BODY_SIZE

      private static final int NON_BODY_SIZE
      See Also:
  • Constructor Details

    • Frame

      public Frame(int type, int channel)
      Constructs a frame for output with a type and a channel number and a fresh accumulator waiting for payload.
    • Frame

      public Frame(int type, int channel, byte[] payload)
      Constructs a frame for input with a type, a channel number and a payload byte array.
  • Method Details