org.apache.qpid.transport.codec
Interface Decoder

All Known Implementing Classes:
AbstractDecoder, BBDecoder

public interface Decoder

Decoder interface. Each concrete implementor must specify how to decode given values.


Method Summary
 boolean hasRemaining()
          Tells whether there are any remaining byte(s) to be read.
 List<Object> readArray()
          An array is an ordered sequence of values of the same type.
 byte[] readBin128()
          The bin128 type consists of 16 consecutive octets of opaque binary data.
 RangeSet readByteRanges()
           
 byte[] readBytes(int howManyBytes)
          Reads the given number of bytes.
 long readDatetime()
          The datetime type encodes a date and time using the 64 bit POSIX time_t format.
 double readDouble()
          The double type encodes a double precision 64-bit floating point number.
 float readFloat()
          The float type encodes a single precision 32-bit floating point number.
 short readInt16()
          The int16 type is a signed integral value encoded using a 16-bit two's complement representation in network byte order.
 int readInt32()
          The int32 type is a signed integral value encoded using a 32-bit two's complement representation in network byte order.
 long readInt64()
          The int64 type is a signed integral value encoded using a 64-bit two's complement representation in network byte order.
 byte readInt8()
          The int8 type is a signed integral value encoded using an 8-bit two's complement representation.
 List<Object> readList()
          A list is an ordered sequence of (type, value) pairs.
 Map<String,Object> readMap()
          A map is a set of distinct keys where each key has an associated (type,value) pair.
 byte[] readReaminingBytes()
          Reads the remaining bytes on the underlying buffer.
 int readSequenceNo()
          // *The sequence-no type encodes, in network byte order, a serial number as defined in RFC-1982.
 RangeSet readSequenceSet()
           
 String readStr16()
          The str16 type encodes up to 65535 octets worth of UTF-8 unicode.
 String readStr8()
          The str8 type encodes up to 255 octets worth of UTF-8 unicode.
 Struct readStruct(int type)
           
 Struct readStruct32()
          The struct32 type describes any coded struct with a 32-bit (4 octet) size.
 int readUint16()
          The uint16 type is a 16-bit unsigned integral value encoded in network byte order.
 long readUint32()
          The uint32 type is a 32-bit unsigned integral value encoded in network byte order.
 long readUint64()
          The uint64 type is a 64-bit unsigned integral value encoded in network byte order.
 short readUint8()
          The uint8 type is an 8-bit unsigned integral value.
 UUID readUuid()
          The uuid type encodes a universally unique id as defined by RFC-4122.
 byte[] readVbin16()
          The vbin16 type encodes up to 65535 octets of opaque binary data.
 byte[] readVbin32()
          The vbin32 type encodes up to 4294967295 octets of opaque binary data.
 byte[] readVbin8()
          The vbin8 type encodes up to 255 octets of opaque binary data.
 

Method Detail

hasRemaining

boolean hasRemaining()
Tells whether there are any remaining byte(s) to be read.

Returns:
true if there are remaining bytes, false otherwise.

readUint8

short readUint8()
The uint8 type is an 8-bit unsigned integral value.

Returns:
an 8-bit unsigned integral value.

readUint16

int readUint16()
The uint16 type is a 16-bit unsigned integral value encoded in network byte order.

Returns:
a 16-bit unsigned integral value encoded in network byte order.

readUint32

long readUint32()
The uint32 type is a 32-bit unsigned integral value encoded in network byte order.

Returns:
a 32-bit unsigned integral value encoded in network byte order.

readUint64

long readUint64()
The uint64 type is a 64-bit unsigned integral value encoded in network byte order.

Returns:
a 64-bit unsigned integral value encoded in network byte order.

readDatetime

long readDatetime()
The datetime type encodes a date and time using the 64 bit POSIX time_t format.

Returns:
a date and time using the 64 bit POSIX time_t format.

readUuid

UUID readUuid()
The uuid type encodes a universally unique id as defined by RFC-4122. The format and operations for this type can be found in section 4.1.2 of RFC-4122. return a universally unique id as defined by RFC-4122.


readSequenceNo

int readSequenceNo()
// *The sequence-no type encodes, in network byte order, a serial number as defined in RFC-1982.

Returns:
a serial number as defined in RFC-1982.

readSequenceSet

RangeSet readSequenceSet()

readByteRanges

RangeSet readByteRanges()

readStr8

String readStr8()
The str8 type encodes up to 255 octets worth of UTF-8 unicode. The number of octets of unicode is first encoded as an 8-bit unsigned integral value. This is followed by the actual UTF-8 unicode. Note that the encoded size refers to the number of octets of unicode, not necessarily the number of characters since the UTF-8 unicode may include multi-byte character sequences.

Returns:
a string.

readStr16

String readStr16()
The str16 type encodes up to 65535 octets worth of UTF-8 unicode. The number of octets is first encoded as a 16-bit unsigned integral value in network byte order. This is followed by the actual UTF-8 unicode. Note that the encoded size refers to the number of octets of unicode, not necessarily the number of unicode characters since the UTF-8 unicode may include multi-byte character sequences. return a string.


readVbin8

byte[] readVbin8()
The vbin8 type encodes up to 255 octets of opaque binary data. return a byte array.


readVbin16

byte[] readVbin16()
The vbin16 type encodes up to 65535 octets of opaque binary data.

Returns:
the corresponding byte array.

readVbin32

byte[] readVbin32()
The vbin32 type encodes up to 4294967295 octets of opaque binary data.

Returns:
the corresponding byte array.

readStruct32

Struct readStruct32()
The struct32 type describes any coded struct with a 32-bit (4 octet) size. The type is restricted to be only coded structs with a 32-bit size, consequently the first six octets of any encoded value for this type MUST always contain the size, class-code, and struct-code in that order. The size is encoded as a 32-bit unsigned integral value in network byte order that is equal to the size of the encoded field-data, packing-flags, class-code, and struct-code. The class-code is a single octet that may be set to any valid class code. The struct-code is a single octet that may be set to any valid struct code within the given class-code. The first six octets are then followed by the packing flags and encoded field data. The presence and quantity of packingflags, as well as the specific fields are determined by the struct definition identified with the encoded class-code and struct-code.

Returns:
the decoded struct.

readMap

Map<String,Object> readMap()
A map is a set of distinct keys where each key has an associated (type,value) pair. The triple of the key, type, and value, form an entry within a map. Each entry within a given map MUST have a distinct key. A map is encoded as a size in octets, a count of the number of entries, followed by the encoded entries themselves. An encoded map may contain up to (4294967295 - 4) octets worth of encoded entries. The size is encoded as a 32-bit unsigned integral value in network byte order equal to the number of octets worth of encoded entries plus 4. (The extra 4 octets is added for the entry count.) The size is then followed by the number of entries encoded as a 32-bit unsigned integral value in network byte order. Finally the entries are encoded sequentially. An entry is encoded as the key, followed by the type, and then the value. The key is always a string encoded as a str8. The type is a single octet that may contain any valid AMQP type code. The value is encoded according to the rules defined by the type code for that entry.

Returns:
the decoded map.

readList

List<Object> readList()
A list is an ordered sequence of (type, value) pairs. The (type, value) pair forms an item within the list. The list may contain items of many distinct types. A list is encoded as a size in octets, followed by a count of the number of items, followed by the items themselves encoded in their defined order. An encoded list may contain up to (4294967295 - 4) octets worth of encoded items. The size is encoded as a 32-bit unsigned integral value in network byte order equal to the number of octets worth of encoded items plus 4. (The extra4 octets is added for the item count.) The size is then followed by the number of items encoded as a 32-bit unsigned integral value in network byte order. Finally the items are encoded sequentially in their defined order. An item is encoded as the type followed by the value. The type is a single octet that may contain any valid AMQP type code. The value is encoded according to the rules defined by the type code for that item.

Returns:
the decoded list.

readArray

List<Object> readArray()
An array is an ordered sequence of values of the same type. The array is encoded in as a size in octets, followed by a type code, then a count of the number values in the array, and finally the values encoded in their defined order. An encoded array may contain up to (4294967295 - 5) octets worth of encoded values. The size is encoded as a 32-bit unsigned integral value in network byte order equal to the number of octets worth of encoded values plus 5. (The extra 5 octets consist of 4 octets for the count of the number of values, and one octet to hold the type code for the items inthe array.) The size is then followed by a single octet that may contain any valid AMQP type code. The type code is then followed by the number of values encoded as a 32-bit unsigned integral value in network byte order. Finally the values are encoded sequentially in their defined order according to the rules defined by the type code for the array.

Returns:
the decoded array.

readStruct

Struct readStruct(int type)
Parameters:
type - the type of the struct.
Returns:
the decoded struct.

readFloat

float readFloat()
The float type encodes a single precision 32-bit floating point number. The format and operations are defined by the IEEE 754 standard for 32-bit single precision floating point numbers.

Returns:
the decoded float.

readDouble

double readDouble()
The double type encodes a double precision 64-bit floating point number. The format and operations are defined by the IEEE 754 standard for 64-bit double precision floating point numbers.

Returns:
the decoded double

readInt8

byte readInt8()
The int8 type is a signed integral value encoded using an 8-bit two's complement representation.

Returns:
the decoded integer.

readInt16

short readInt16()
The int16 type is a signed integral value encoded using a 16-bit two's complement representation in network byte order.

Returns:
the decoded integer.

readInt32

int readInt32()
The int32 type is a signed integral value encoded using a 32-bit two's complement representation in network byte order.

Returns:
the decoded integer.

readInt64

long readInt64()
The int64 type is a signed integral value encoded using a 64-bit two's complement representation in network byte order.

Returns:
the decoded integer (as long).

readBin128

byte[] readBin128()
The bin128 type consists of 16 consecutive octets of opaque binary data.

Returns:
the decoded byte array.

readReaminingBytes

byte[] readReaminingBytes()
Reads the remaining bytes on the underlying buffer.

Returns:
the remaining bytes on the underlying buffer.

readBytes

byte[] readBytes(int howManyBytes)
Reads the given number of bytes.

Parameters:
howManyBytes - how many bytes need to be read?
Returns:
a byte array containing the requested data.


Licensed to the Apache Software Foundation