public class Frame extends Object
Modifier and Type | Field and Description |
---|---|
int |
channel
Frame channel number, 0-65535
|
int |
type
Frame type code
|
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
static long |
arraySize(List<?> values)
Computes the AMQP 0-9-1 wire-protocol length of an encoded field-array of type List
|
static long |
arraySize(Object[] values)
Computes the AMQP wire-protocol length of an encoded field-array of type Object[]
|
static Frame |
fromBodyFragment(int channelNumber,
byte[] body,
int offset,
int length) |
DataInputStream |
getInputStream()
Public API - retrieves a new DataInputStream streaming over the payload
|
DataOutputStream |
getOutputStream()
Public API - retrieves a fresh DataOutputStream streaming into the accumulator
|
byte[] |
getPayload()
Public API - retrieves the frame payload
|
static void |
protocolVersionMismatch(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(DataInputStream is)
Protected API - Factory method to instantiate a Frame by reading an
AMQP-wire-protocol frame from the given input stream.
|
int |
size() |
static long |
tableSize(Map<String,Object> table)
Computes the AMQP wire-protocol length of protocol-encoded table entries.
|
String |
toString() |
void |
writeTo(DataOutputStream os)
Public API - writes this Frame to the given DataOutputStream
|
public final int type
public final int channel
public Frame(int type, int channel)
public Frame(int type, int channel, byte[] payload)
public static Frame fromBodyFragment(int channelNumber, byte[] body, int offset, int length) throws IOException
IOException
public static Frame readFrom(DataInputStream is) throws IOException
IOException
public static void protocolVersionMismatch(DataInputStream is) throws IOException
MalformedFrameException
- if an AMQP protocol version mismatch is detectedMalformedFrameException
- if a corrupt AMQP protocol identifier is readIOException
public void writeTo(DataOutputStream os) throws IOException
IOException
public int size()
public byte[] getPayload()
public DataInputStream getInputStream()
public DataOutputStream getOutputStream()
public static long tableSize(Map<String,Object> table) throws UnsupportedEncodingException
UnsupportedEncodingException
public static long arraySize(List<?> values) throws UnsupportedEncodingException
UnsupportedEncodingException
public static long arraySize(Object[] values) throws UnsupportedEncodingException
UnsupportedEncodingException
Copyright © 2022 VMware, Inc. or its affiliates.. All rights reserved.