org.apache.qpid.transport.codec
Class AbstractDecoder
java.lang.Object
org.apache.qpid.transport.codec.AbstractDecoder
- All Implemented Interfaces:
- Decoder
- Direct Known Subclasses:
- BBDecoder
abstract class AbstractDecoder
- extends Object
- implements Decoder
AbstractDecoder
Method Summary |
protected abstract byte |
doGet()
|
protected abstract void |
doGet(byte[] bytes)
|
protected byte |
get()
|
protected void |
get(byte[] bytes)
|
protected Binary |
get(int size)
|
List<Object> |
readArray()
An array is an ordered sequence of values of the same type. |
RangeSet |
readByteRanges()
|
String |
readContent()
|
long |
readDatetime()
The datetime type encodes a date and time using the 64 bit POSIX time_t format. |
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. |
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. |
protected short |
uget()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractDecoder
AbstractDecoder()
doGet
protected abstract byte doGet()
doGet
protected abstract void doGet(byte[] bytes)
get
protected byte get()
get
protected void get(byte[] bytes)
get
protected Binary get(int size)
uget
protected short uget()
readUint8
public short readUint8()
- Description copied from interface:
Decoder
- The uint8 type is an 8-bit unsigned integral value.
- Specified by:
readUint8
in interface Decoder
- Returns:
- an 8-bit unsigned integral value.
readUint16
public int readUint16()
- Description copied from interface:
Decoder
- The uint16 type is a 16-bit unsigned integral value encoded in network byte order.
- Specified by:
readUint16
in interface Decoder
- Returns:
- a 16-bit unsigned integral value encoded in network byte order.
readUint32
public long readUint32()
- Description copied from interface:
Decoder
- The uint32 type is a 32-bit unsigned integral value encoded in network byte order.
- Specified by:
readUint32
in interface Decoder
- Returns:
- a 32-bit unsigned integral value encoded in network byte order.
readSequenceNo
public int readSequenceNo()
- Description copied from interface:
Decoder
- // *The sequence-no type encodes, in network byte order, a serial number as defined in RFC-1982.
- Specified by:
readSequenceNo
in interface Decoder
- Returns:
- a serial number as defined in RFC-1982.
readUint64
public long readUint64()
- Description copied from interface:
Decoder
- The uint64 type is a 64-bit unsigned integral value encoded in network byte order.
- Specified by:
readUint64
in interface Decoder
- Returns:
- a 64-bit unsigned integral value encoded in network byte order.
readDatetime
public long readDatetime()
- Description copied from interface:
Decoder
- The datetime type encodes a date and time using the 64 bit POSIX time_t format.
- Specified by:
readDatetime
in interface Decoder
- Returns:
- a date and time using the 64 bit POSIX time_t format.
readStr8
public String readStr8()
- Description copied from interface:
Decoder
- 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.
- Specified by:
readStr8
in interface Decoder
- Returns:
- a string.
readStr16
public String readStr16()
- Description copied from interface:
Decoder
- 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.
- Specified by:
readStr16
in interface Decoder
readVbin8
public byte[] readVbin8()
- Description copied from interface:
Decoder
- The vbin8 type encodes up to 255 octets of opaque binary data.
return a byte array.
- Specified by:
readVbin8
in interface Decoder
readVbin16
public byte[] readVbin16()
- Description copied from interface:
Decoder
- The vbin16 type encodes up to 65535 octets of opaque binary data.
- Specified by:
readVbin16
in interface Decoder
- Returns:
- the corresponding byte array.
readVbin32
public byte[] readVbin32()
- Description copied from interface:
Decoder
- The vbin32 type encodes up to 4294967295 octets of opaque binary data.
- Specified by:
readVbin32
in interface Decoder
- Returns:
- the corresponding byte array.
readSequenceSet
public RangeSet readSequenceSet()
- Specified by:
readSequenceSet
in interface Decoder
readByteRanges
public RangeSet readByteRanges()
- Specified by:
readByteRanges
in interface Decoder
readUuid
public UUID readUuid()
- Description copied from interface:
Decoder
- 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.
- Specified by:
readUuid
in interface Decoder
readContent
public String readContent()
readStruct
public Struct readStruct(int type)
- Specified by:
readStruct
in interface Decoder
- Parameters:
type
- the type of the struct.
- Returns:
- the decoded struct.
readStruct32
public Struct readStruct32()
- Description copied from interface:
Decoder
- 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.
- Specified by:
readStruct32
in interface Decoder
- Returns:
- the decoded struct.
readMap
public Map<String,Object> readMap()
- Description copied from interface:
Decoder
- 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.
- Specified by:
readMap
in interface Decoder
- Returns:
- the decoded map.
readList
public List<Object> readList()
- Description copied from interface:
Decoder
- 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.
- Specified by:
readList
in interface Decoder
- Returns:
- the decoded list.
readArray
public List<Object> readArray()
- Description copied from interface:
Decoder
- 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.
- Specified by:
readArray
in interface Decoder
- Returns:
- the decoded array.
Licensed to the Apache Software Foundation