summaryrefslogtreecommitdiff
path: root/java/common/src
diff options
context:
space:
mode:
authorArnaud Simon <arnaudsimon@apache.org>2008-11-19 12:59:28 +0000
committerArnaud Simon <arnaudsimon@apache.org>2008-11-19 12:59:28 +0000
commit6a42c34f84ad6fbafcd38ab6e06a2a234c85fdc8 (patch)
treef0ecda4484704f945eeab613f74bf95e67f057ca /java/common/src
parentce06bf4a1fa2390180ddb18b4ea87e88279b7d36 (diff)
downloadqpid-python-6a42c34f84ad6fbafcd38ab6e06a2a234c85fdc8.tar.gz
QPID-1463: Andrea's patches
- Added read / write methods on org.apache.qpid.transport.codec.Encoder / org.apache.qpid.transport.codec.Decoder; - Added the corresponding implementation on org.apache.qpid.transport.codec.BBEncoder / org.apache.qpid.transport.codec.BBDecoder - Added comments on org.apache.qpid.transport.codec.Encoder / org.apache.qpid.transport.codec.Decoder; - Removed org.apache.qpid.transport.codec.ManagementEncoder / org.apache.qpid.transport.codec.ManagementDecoder. - Added 6 data types (Int8, Int16, Int32, Int64, Double and Float); - Added type mappings with the data types above according to management specifications; - Removed all references to ManagementEncoder / Decoder classes; Now Qman is using (whenever is possible) Decoder / Encoder and when some specific method is needed then the BBDecoder / BBEncoder is used. - Some test case adjustment; git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@718949 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src')
-rw-r--r--java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java58
-rw-r--r--java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java101
-rw-r--r--java/common/src/main/java/org/apache/qpid/transport/codec/Decoder.java227
-rw-r--r--java/common/src/main/java/org/apache/qpid/transport/codec/Encodable.java19
-rw-r--r--java/common/src/main/java/org/apache/qpid/transport/codec/Encoder.java230
-rw-r--r--java/common/src/main/java/org/apache/qpid/transport/codec/ManagementDecoder.java109
-rw-r--r--java/common/src/main/java/org/apache/qpid/transport/codec/ManagementEncoder.java86
7 files changed, 606 insertions, 224 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java b/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java
index dd634eb94a..6f7a2fa3b2 100644
--- a/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java
+++ b/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java
@@ -25,16 +25,14 @@ import java.nio.ByteOrder;
import org.apache.qpid.transport.Binary;
-
/**
- * BBDecoder
+ * Byte Buffer Decoder.
+ * Decoder concrete implementor using a backing byte buffer for decoding data.
*
* @author Rafael H. Schloming
*/
-
public final class BBDecoder extends AbstractDecoder
{
-
private ByteBuffer in;
public void init(ByteBuffer in)
@@ -93,4 +91,54 @@ public final class BBDecoder extends AbstractDecoder
return in.getLong();
}
-}
+ public byte[] readBin128()
+ {
+ byte[] result = new byte[16];
+ get(result);
+ return result;
+ }
+
+ public byte[] readBytes(int howManyBytes)
+ {
+ byte[] result = new byte[howManyBytes];
+ get(result);
+ return result;
+ }
+
+ public double readDouble()
+ {
+ return in.getDouble();
+ }
+
+ public float readFloat()
+ {
+ return in.getFloat();
+ }
+
+ public short readInt16()
+ {
+ return in.getShort();
+ }
+
+ public int readInt32()
+ {
+ return in.getInt();
+ }
+
+ public byte readInt8()
+ {
+ return in.get();
+ }
+
+ public byte[] readReaminingBytes()
+ {
+ byte[] result = new byte[in.limit() - in.position()];
+ get(result);
+ return result;
+ }
+
+ public long readInt64()
+ {
+ return in.getLong();
+ }
+} \ No newline at end of file
diff --git a/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java b/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java
index 390de881ab..532c19ec18 100644
--- a/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java
+++ b/java/common/src/main/java/org/apache/qpid/transport/codec/BBEncoder.java
@@ -26,14 +26,13 @@ import java.nio.ByteOrder;
/**
- * BBEncoder
- *
+ * Byte Buffer Encoder.
+ * Encoder concrete implementor using a backing byte buffer for encoding data.
+ *
* @author Rafael H. Schloming
*/
-
public final class BBEncoder extends AbstractEncoder
{
-
private ByteBuffer out;
private int segment;
@@ -229,4 +228,96 @@ public final class BBEncoder extends AbstractEncoder
out.putInt(pos, (cur - pos - 4));
}
-}
+ public void writeDouble(double aDouble)
+ {
+ try
+ {
+ out.putDouble(aDouble);
+ } catch(BufferOverflowException exception)
+ {
+ grow(8);
+ out.putDouble(aDouble);
+ }
+ }
+
+ public void writeInt16(short aShort)
+ {
+ try
+ {
+ out.putShort(aShort);
+ } catch(BufferOverflowException exception)
+ {
+ grow(2);
+ out.putShort(aShort);
+ }
+ }
+
+ public void writeInt32(int anInt)
+ {
+ try
+ {
+ out.putInt(anInt);
+ } catch(BufferOverflowException exception)
+ {
+ grow(4);
+ out.putInt(anInt);
+ }
+ }
+
+ public void writeInt64(long aLong)
+ {
+ try
+ {
+ out.putLong(aLong);
+ } catch(BufferOverflowException exception)
+ {
+ grow(8);
+ out.putLong(aLong);
+ }
+ }
+
+ public void writeInt8(byte aByte)
+ {
+ try
+ {
+ out.put(aByte);
+ } catch(BufferOverflowException exception)
+ {
+ grow(1);
+ out.put(aByte);
+ }
+ }
+
+ public void writeBin128(byte[] byteArray)
+ {
+ byteArray = (byteArray != null) ? byteArray : new byte [16];
+
+ assert byteArray.length == 16;
+
+ try
+ {
+ out.put(byteArray);
+ } catch(BufferOverflowException exception)
+ {
+ grow(16);
+ out.put(byteArray);
+ }
+ }
+
+ public void writeFloat(float aFloat)
+ {
+ try
+ {
+ out.putFloat(aFloat);
+ } catch(BufferOverflowException exception)
+ {
+ grow(4);
+ out.putFloat(aFloat);
+ }
+ }
+
+ public void writeMagicNumber()
+ {
+ out.put("AM2".getBytes());
+ }
+} \ No newline at end of file
diff --git a/java/common/src/main/java/org/apache/qpid/transport/codec/Decoder.java b/java/common/src/main/java/org/apache/qpid/transport/codec/Decoder.java
index 50e787ccb2..a4df5b5fcb 100644
--- a/java/common/src/main/java/org/apache/qpid/transport/codec/Decoder.java
+++ b/java/common/src/main/java/org/apache/qpid/transport/codec/Decoder.java
@@ -29,40 +29,255 @@ import org.apache.qpid.transport.Struct;
/**
- * Decoder
- *
+ * Decoder interface.
+ * Each concrete implementor must specify how to decode given values.
+ *
* @author Rafael H. Schloming
*/
-
public interface Decoder
{
-
+ /**
+ * Tells whether there are any remaining byte(s) to be read.
+ *
+ * @return true if there are remaining bytes, false otherwise.
+ */
boolean hasRemaining();
+ /**
+ * The uint8 type is an 8-bit unsigned integral value.
+ *
+ * @return an 8-bit unsigned integral value.
+ */
short readUint8();
+
+ /**
+ *The uint16 type is a 16-bit unsigned integral value encoded in network byte order.
+ *
+ * @return a 16-bit unsigned integral value encoded in network byte order.
+ */
int readUint16();
+
+ /**
+ *The uint32 type is a 32-bit unsigned integral value encoded in network byte order.
+ *
+ * @return a 32-bit unsigned integral value encoded in network byte order.
+ */
long readUint32();
+
+ /**
+ * The uint64 type is a 64-bit unsigned integral value encoded in network byte order.
+ *
+ * @return a 64-bit unsigned integral value encoded in network byte order.
+ */
long readUint64();
+ /**
+ * The datetime type encodes a date and time using the 64 bit POSIX time_t format.
+ *
+ * @return a date and time using the 64 bit POSIX time_t format.
+ */
long readDatetime();
+
+ /**
+ * 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.
+ */
UUID readUuid();
+ /**
+// *The sequence-no type encodes, in network byte order, a serial number as defined in RFC-1982.
+ *
+ * @return a serial number as defined in RFC-1982.
+ */
int readSequenceNo();
+
RangeSet readSequenceSet(); // XXX
RangeSet readByteRanges(); // XXX
+ /**
+ * 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.
+ *
+ * @return a string.
+ */
String readStr8();
+
+ /**
+ * 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.
+ */
String readStr16();
+ /**
+ * The vbin8 type encodes up to 255 octets of opaque binary data.
+ *
+ * return a byte array.
+ */
byte[] readVbin8();
+
+ /**
+ * The vbin16 type encodes up to 65535 octets of opaque binary data.
+ *
+ * @return the corresponding byte array.
+ */
byte[] readVbin16();
+
+ /**
+ * The vbin32 type encodes up to 4294967295 octets of opaque binary data.
+ *
+ * @return the corresponding byte array.
+ */
byte[] readVbin32();
+ /**
+ * 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.
+ *
+ * @return the decoded struct.
+ */
Struct readStruct32();
+
+ /**
+ * 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.
+ *
+ * @return the decoded map.
+ */
Map<String,Object> readMap();
+
+ /**
+ * 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.
+ *
+ * @return the decoded list.
+ */
List<Object> readList();
+
+ /**
+ * 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.
+ *
+ * @return the decoded array.
+ */
List<Object> readArray();
+ /**
+ *
+ * @param type the type of the struct.
+ * @return the decoded struct.
+ */
Struct readStruct(int type);
-
-}
+
+ /**
+ * 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.
+ *
+ * @return the decoded float.
+ */
+ float readFloat();
+
+ /**
+ * 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.
+ *
+ * @return the decoded double
+ */
+ double readDouble();
+
+ /**
+ * The int8 type is a signed integral value encoded using an 8-bit two's complement representation.
+ *
+ * @return the decoded integer.
+ */
+ byte readInt8();
+
+ /**
+ * The int16 type is a signed integral value encoded using a 16-bit two's complement representation in network byte order.
+ *
+ * @return the decoded integer.
+ */
+ short readInt16();
+
+ /**
+ * The int32 type is a signed integral value encoded using a 32-bit two's complement representation in network byte order.
+ *
+ * @return the decoded integer.
+ */
+ int readInt32();
+
+ /**
+ * The int64 type is a signed integral value encoded using a 64-bit two's complement representation in network byte order.
+ *
+ * @return the decoded integer (as long).
+ */
+ long readInt64();
+
+ /**
+ * The bin128 type consists of 16 consecutive octets of opaque binary data.
+ *
+ * @return the decoded byte array.
+ */
+ byte [] readBin128();
+
+ /**
+ * Reads the remaining bytes on the underlying buffer.
+ *
+ * @return the remaining bytes on the underlying buffer.
+ */
+ byte[] readReaminingBytes ();
+
+ /**
+ * Reads the given number of bytes.
+ *
+ * @param howManyBytes how many bytes need to be read?
+ * @return a byte array containing the requested data.
+ */
+ byte[] readBytes (int howManyBytes);
+} \ No newline at end of file
diff --git a/java/common/src/main/java/org/apache/qpid/transport/codec/Encodable.java b/java/common/src/main/java/org/apache/qpid/transport/codec/Encodable.java
index 2aefafd19c..37ce8a5cb7 100644
--- a/java/common/src/main/java/org/apache/qpid/transport/codec/Encodable.java
+++ b/java/common/src/main/java/org/apache/qpid/transport/codec/Encodable.java
@@ -26,12 +26,19 @@ package org.apache.qpid.transport.codec;
*
* @author Rafael H. Schloming
*/
-
public interface Encodable
{
+ /**
+ * Encodes this encodable using the given encoder.
+ *
+ * @param encoder the encoder.
+ */
+ void write(Encoder encoder);
- void write(Encoder enc);
-
- void read(Decoder dec);
-
-}
+ /**
+ * Decodes this encodable using the given decoder.
+ *
+ * @param decoder the decoder.
+ */
+ void read(Decoder decoder);
+} \ No newline at end of file
diff --git a/java/common/src/main/java/org/apache/qpid/transport/codec/Encoder.java b/java/common/src/main/java/org/apache/qpid/transport/codec/Encoder.java
index 2d8d13e80a..7d4f02af31 100644
--- a/java/common/src/main/java/org/apache/qpid/transport/codec/Encoder.java
+++ b/java/common/src/main/java/org/apache/qpid/transport/codec/Encoder.java
@@ -29,38 +29,254 @@ import org.apache.qpid.transport.Struct;
/**
- * Encoder
+ * Encoder interface.
+ * Each concrete implementor must specify how to encode given values.
*
* @author Rafael H. Schloming
*/
-
public interface Encoder
{
-
+ /**
+ * The uint8 type is an 8-bit unsigned integral value.
+ *
+ * @param b the unsigned integer to be encoded.
+ */
void writeUint8(short b);
+
+ /**
+ *The uint16 type is a 16-bit unsigned integral value encoded in network byte order.
+ *
+ * @param s the unsigned integer to be encoded.
+ */
void writeUint16(int s);
+
+ /**
+ *The uint32 type is a 32-bit unsigned integral value encoded in network byte order.
+ *
+ * @param i the unsigned integer to be encoded.
+ */
void writeUint32(long i);
+
+ /**
+ * The uint64 type is a 64-bit unsigned integral value encoded in network byte order.
+ *
+ * @param b the unsigned integer to be encoded.
+ */
void writeUint64(long l);
+ /**
+ * The datetime type encodes a date and time using the 64 bit POSIX time_t format.
+ *
+ * @param l the datetime (as long) to be encoded.
+ */
void writeDatetime(long l);
+
+ /**
+ * 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.
+ *
+ * @param uuid the uuid to be encoded.
+ */
void writeUuid(UUID uuid);
+ /**
+ *The sequence-no type encodes, in network byte order, a serial number as defined in RFC-1982.
+ *
+ * @param s the sequence number to be encoded.
+ */
void writeSequenceNo(int s);
+
void writeSequenceSet(RangeSet ranges); // XXX
void writeByteRanges(RangeSet ranges); // XXX
+ /**
+ * 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.
+ *
+ * @param s the string to be encoded.
+ */
void writeStr8(String s);
+
+ /**
+ * 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.
+ *
+ * @param s the string to be encoded.
+ */
void writeStr16(String s);
+ /**
+ * The vbin8 type encodes up to 255 octets of opaque binary data.
+ * The number of octets is first encoded as an 8-bit unsigned integral value.
+ * This is followed by the actual data.
+ *
+ * @param bytes the byte array to be encoded.
+ */
void writeVbin8(byte[] bytes);
+
+ /**
+ * The vbin16 type encodes up to 65535 octets of opaque binary data.
+ * The number of octets is first encoded as a 16-bit unsigned integral value in network byte order.
+ * This is followed by the actual data.
+ *
+ * @param bytes the byte array to be encoded.
+ */
void writeVbin16(byte[] bytes);
+
+ /**
+ * The vbin32 type encodes up to 4294967295 octets of opaque binary data.
+ * The number of octets is first encoded as a 32-bit unsigned integral value in network byte order.
+ * This is followed by the actual data.
+ *
+ * @param bytes the byte array to be encoded.
+ */
void writeVbin32(byte[] bytes);
- void writeStruct32(Struct s);
+ /**
+ * 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.
+ *
+ * @param struct the struct to be encoded.
+ */
+ void writeStruct32(Struct struct);
+
+ /**
+ * 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.
+ *
+ * @param map the map to be encoded.
+ */
void writeMap(Map<String,Object> map);
+
+ /**
+ * 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.
+ *
+ * @param list the list to be encoded.
+ */
void writeList(List<Object> list);
+
+ /**
+ * 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.
+ *
+ * @param array the array to be encoded.
+ */
void writeArray(List<Object> array);
- void writeStruct(int type, Struct s);
-
-}
+ /**
+ * 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.
+ *
+ * @param type the type of the struct.
+ * @param struct the struct to be encoded.
+ */
+ void writeStruct(int type, Struct struct);
+
+ /**
+ * 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.
+ *
+ * @param aFloat the float to be encoded.
+ */
+ void writeFloat(float aFloat);
+
+ /**
+ * 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.
+ *
+ * @param aDouble the double to be encoded.
+ */
+ void writeDouble(double aDouble);
+
+ /**
+ * The int8 type is a signed integral value encoded using an 8-bit two's complement representation.
+ *
+ * @param aByte the integer to be encoded.
+ */
+ void writeInt8(byte aByte);
+
+ /**
+ * The int16 type is a signed integral value encoded using a 16-bit two's complement representation in network byte order.
+ *
+ * @param aShort the integer to be encoded.
+ */
+ void writeInt16(short aShort);
+
+ /**
+ * The int32 type is a signed integral value encoded using a 32-bit two's complement representation in network byte order.
+ *
+ * @param anInt the integer to be encoded.
+ */
+ void writeInt32(int anInt);
+
+ /**
+ * The int64 type is a signed integral value encoded using a 64-bit two's complement representation in network byte order.
+ *
+ * @param aLong the integer to be encoded.
+ */
+ void writeInt64(long aLong);
+
+ /**
+ * The bin128 type consists of 16 consecutive octets of opaque binary data.
+ *
+ * @param bytes the bytes array to be encoded.
+ */
+ void writeBin128(byte [] bytes);
+
+ /**
+ * Encodes the AMQP magic number.
+ */
+ void writeMagicNumber();
+} \ No newline at end of file
diff --git a/java/common/src/main/java/org/apache/qpid/transport/codec/ManagementDecoder.java b/java/common/src/main/java/org/apache/qpid/transport/codec/ManagementDecoder.java
deleted file mode 100644
index 1e9fdc5e3e..0000000000
--- a/java/common/src/main/java/org/apache/qpid/transport/codec/ManagementDecoder.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.apache.qpid.transport.codec;
-
-import java.nio.ByteBuffer;
-import java.util.Map;
-import java.util.UUID;
-
-
-/*
- * Extends BBDecoder to add some additional methods.
- *
- * FIXME (Gazza) : I don't like very much this class...this code should be part of BBDecoder
- */
-public class ManagementDecoder
-{
- private BBDecoder _decoder;
- private ByteBuffer _buffer;
-
- public void init(ByteBuffer buffer)
- {
- this._buffer = buffer;
- this._decoder = new BBDecoder();
- _decoder.init(_buffer);
- }
-
- public byte[] readReaminingBytes ()
- {
- byte[] result = new byte[_buffer.limit() - _buffer.position()];
- _decoder.get(result);
- return result;
- }
-
- public byte[] readBin128() {
- byte[] result = new byte[16];
- _decoder.get(result);
- return result;
- }
-
- public byte[] readBytes (int howMany)
- {
- byte [] result = new byte[howMany];
- _decoder.get(result);
- return result;
- }
-
- public long readDatetime ()
- {
- return _decoder.readDatetime();
- }
-
- public Map<String, Object> readMap ()
- {
- return _decoder.readMap();
- }
-
- public int readSequenceNo ()
- {
- return _decoder.readSequenceNo();
- }
-
- public String readStr16 ()
- {
- return _decoder.readStr16();
- }
-
- public String readStr8 ()
- {
- return _decoder.readStr8();
- }
-
- public int readUint16 ()
- {
- return _decoder.readUint16();
- }
-
- public long readUint32 ()
- {
- return _decoder.readUint32();
- }
-
- public long readUint64 ()
- {
- return _decoder.readUint64();
- }
-
- public short readUint8 ()
- {
- return _decoder.readUint8();
- }
-
- public UUID readUuid ()
- {
- return _decoder.readUuid();
- }
-
- public byte[] readVbin16 ()
- {
- return _decoder.readVbin16();
- }
-
- public byte[] readVbin32 ()
- {
- return _decoder.readVbin32();
- }
-
- public byte[] readVbin8 ()
- {
- return _decoder.readVbin8();
- }
-} \ No newline at end of file
diff --git a/java/common/src/main/java/org/apache/qpid/transport/codec/ManagementEncoder.java b/java/common/src/main/java/org/apache/qpid/transport/codec/ManagementEncoder.java
deleted file mode 100644
index 3dc4fe9ae3..0000000000
--- a/java/common/src/main/java/org/apache/qpid/transport/codec/ManagementEncoder.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.apache.qpid.transport.codec;
-
-
-import java.nio.ByteBuffer;
-
-import org.apache.qpid.transport.codec.AbstractEncoder;
-
-/*
- * @author rahulapi@gmailcom
- *
- * Management Encoder extends the basic java encoer (AbastractEncoder)
- * its a java encoder we use to encode the incoming messages
- * (encode the fields of the message)
- *
- * TODO (Gazza) : I don't like very much this class...this code should be part of BBDecoder
- */
-public class ManagementEncoder extends AbstractEncoder{
-
-
- public ByteBuffer _out=null;
-
- public ManagementEncoder(ByteBuffer out)
- {
-
- _out = out;
- }
-
- protected void doPut(byte b)
- {
- _out.put(b);
- }
-
- protected void doPut(ByteBuffer src)
- {
- _out.put(src);
- }
-
- public void writeBin128(byte[] s)
- {
- if(s==null)
- {
- s=new byte[16];
-
- }else if(s.length!=16){
- throw new IllegalArgumentException(""+s);
- }
- put(s);
- }
-
- @Override
- protected int beginSize16() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- protected int beginSize32() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- protected int beginSize8() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- protected void endSize16(int pos) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void endSize32(int pos) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void endSize8(int pos) {
- // TODO Auto-generated method stub
-
- }
-
-} \ No newline at end of file