|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rabbitmq.client.impl.Frame
public class Frame
Represents an AMQP wire-protocol frame, with frame type, channel number, and payload bytes.
Field Summary | |
---|---|
java.io.ByteArrayOutputStream |
accumulator
Frame payload (for outbound frames) |
int |
channel
Frame channel number, 0-65535 |
byte[] |
payload
Frame payload bytes (for inbound frames) |
int |
type
Frame type code |
Constructor Summary | |
---|---|
Frame()
Constructs an uninitialized frame. |
|
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 | |
---|---|
static long |
arraySize(java.util.List values)
Computes the AMQP wire-protocol length of an encoded field-array |
static java.util.Map<java.lang.String,java.lang.Object> |
buildTable(java.lang.Object[] keysValues)
Utility for constructing a java.util.Map instance from an even-length array containing alternating String keys (on the even elements, starting at zero) and values (on the odd elements, starting at one). |
static long |
fieldValueSize(java.lang.Object value)
Computes the AMQP wire-protocol length of a protocol-encoded field-value. |
static Frame |
fromBodyFragment(int channelNumber,
byte[] body,
int offset,
int length)
|
java.io.DataInputStream |
getInputStream()
Public API - retrieves a new DataInputStream streaming over the payload |
java.io.DataOutputStream |
getOutputStream()
Public API - retrieves a fresh DataOutputStream streaming into the accumulator |
byte[] |
getPayload()
Public API - retrieves the frame payload |
static int |
longStrSize(java.lang.String str)
Computes the AMQP wire-protocol length of a protocol-encoded long string. |
static void |
protocolVersionMismatch(java.io.DataInputStream is)
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(java.io.DataInputStream is)
Protected API - Factory method to instantiate a Frame by reading an AMQP-wire-protocol frame from the given input stream. |
static int |
shortStrSize(java.lang.String str)
Computes the AMQP wire-protocol length of a protocol-encoded short string. |
static long |
tableSize(java.util.Map<java.lang.String,java.lang.Object> table)
Computes the AMQP wire-protocol length of protocol-encoded table entries. |
java.lang.String |
toString()
|
void |
writeTo(java.io.DataOutputStream os)
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 Detail |
---|
public int type
public int channel
public byte[] payload
public java.io.ByteArrayOutputStream accumulator
Constructor Detail |
---|
public Frame()
public Frame(int type, int channel)
public Frame(int type, int channel, byte[] payload)
Method Detail |
---|
public static Frame fromBodyFragment(int channelNumber, byte[] body, int offset, int length) throws java.io.IOException
java.io.IOException
public static Frame readFrom(java.io.DataInputStream is) throws java.io.IOException
java.io.IOException
public static void protocolVersionMismatch(java.io.DataInputStream is) throws java.io.IOException
MalformedFrameException
- if an AMQP protocol version mismatch is detected
MalformedFrameException
- if a corrupt AMQP protocol identifier is read
java.io.IOException
public void writeTo(java.io.DataOutputStream os) throws java.io.IOException
java.io.IOException
public byte[] getPayload()
public java.io.DataInputStream getInputStream()
public java.io.DataOutputStream getOutputStream()
public java.lang.String toString()
toString
in class java.lang.Object
public static java.util.Map<java.lang.String,java.lang.Object> buildTable(java.lang.Object[] keysValues)
public static long tableSize(java.util.Map<java.lang.String,java.lang.Object> table) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static long fieldValueSize(java.lang.Object value) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static long arraySize(java.util.List values) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static int longStrSize(java.lang.String str) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static int shortStrSize(java.lang.String str) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |