es.uc3m.it.xbe32
Class XBE32Writer

java.lang.Object
  extended byes.uc3m.it.xbe32.XBE32Writer

public class XBE32Writer
extends Object

This class allows XBE32 Elements to be serialized and written in an output XBE32-encoded stream.
Please note that no data is actually written into the stream until the serialize() method is called.

For example, in order to encode the following data:

    <service>
      <type> printer </type>
      <addr> 169.254.85.139 (0xA9FE558B) </addr>
      <ports> 515, 631 </ports>
      <options c="true" e="true">
        <color ext="true" e="true" type="boolean"> false </color>
        <ppm ext="true" c="true" type="float32"> 20.5 </ppm>
      </options>
    </service>
 
The following code could be used:

    writer.openComplexElement(0x0001);
    writer.writeStringAttribute(0x2102, type);
    writer.writeOpaque4Attribute(0x2C03, addr.getAddress());
    writer.writeInt16Attribute(0x2904, ports);
    writer.openComplexElement(0xC005);
    writer.writeExtBooleanAttribute(0x00000006, "color", false, true, false);
    writer.writeExtFloat32Attribute(0, "ppm", true, false, 20.5);
    writer.closeComplexElement();
    writer.closeComplexElement();
    writer.serialize();
 

That would generate the following XBE32-encoded stream (TLV view):

     0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0   |              service          |          LENGTH = 76          |  0001 004C
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4   |               type            |          Length = 11          |  2102 000B
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
8   |       'p'     |       'r'     |       'i'     |       'n'     |  7072 696E
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
12  |       't'     |       'e'     |       'r'     |               |  7465 7200
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16  |               addr            |          Length = 8           |  2C03 0008
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20  |                          0xA9FE558B                           |  A9FE 558B
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
24  |               ports           |          Length = 8           |  2904 0008
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
28  |              515              |              631              |  0203 0277
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32  |C|E|          options          |          LENGTH = 44          |  C005 002C
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36  | |E|   <EXT ATTRIBUTE TLV>     |          LENGTH = 20          |  5F00 0014
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40  |           <Ext Id TLV>        |          Length = 8           |  2CFF 0008
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44  |                          0x00000006                           |  0000 0006
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
48  |      <Ext Boolean Value TLV>  |          Length = 5           |  2600 0005
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
52  |      false    |                                               |  0000 0000
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
56  |C|     <EXT ATTRIBUTE TLV>     |          LENGTH = 20          |  9F00 0014
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60  |          <Ext Name TLV>       |          Length = 7           |  21FF 0007
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
64  |       'p'     |       'p'     |       'm'     |               |  7070 6D00
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
68  |      <Ext Float32 Value TLV>  |          Length = 8           |  2E00 0008
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
72  |                             20.5                              |  41A4 0000
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 

This writer may employ a XBE32Dictionary in order to translate the name of the XBE32 Element to be writen into a TLV Type/iddentifier.


Constructor Summary
XBE32Writer(OutputStream os)
          Creates a new XBE32Writer to serialize XBE32 Elements into the specified OutputStream.
 
Method Summary
 void closeComplexElement()
          Closes the last opened Complex Element.
 XBE32Dictionary getDictionary()
          Returns the dictionary employed to translate XBE32 Elements' names into a TLV Type/identifier
 int getOpenElements()
          Returns the number of Complex Elements that have been opened, but not closed yet
 void openComplexElement(boolean ext, int id, String name, boolean c, boolean e)
          Writes a XBE32 Extensible or Compact Complex Element with the specified identifier/name and flags.
 void openComplexElement(int type)
          Writes a XBE32 Compact Complex Element with the specified TLV Type.
 void openComplexElement(int id, String name, boolean c, boolean e)
          Writes a XBE32 Extensible Complex Element with the specified identifier/name and flags.
 int serialize()
          This method is the one that actually writes the XBE32 Element defined before into the OutputStream
 void setDictionary(XBE32Dictionary dict)
          Sets the dictionary to be employed to translate XBE32 Elements' names into a TLV Type/identifier
 void writeAttribute(boolean ext, int id, String name, boolean c, boolean e, int type, Object vals)
          Writes an Compact or Extensible Attribute Element with the specified identifier/name, flags, and Values.
 void writeAttribute(int type, Object val)
          Writes a Compact Attribute Element with the specified TLV Type and Value.
 void writeBooleanAttribute(int type, boolean val)
          Writes a Compact Boolean Attribute Element with the specified TLV Type and a single Value.
 void writeBooleanAttribute(int type, boolean[] vals)
          Writes a Compact Boolean Attribute Element with the specified TLV Type and Value array.
 void writeExtAttribute(int id, String name, boolean c, boolean e, int type, Object vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Values.
 void writeExtBooleanAttribute(int id, String name, boolean c, boolean e, boolean val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Boolean Value.
 void writeExtBooleanAttribute(int id, String name, boolean c, boolean e, boolean[] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Boolean Values.
 void writeExtFloat32Attribute(int id, String name, boolean c, boolean e, float val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Float32 Value.
 void writeExtFloat32Attribute(int id, String name, boolean c, boolean e, float[] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Float32 Values.
 void writeExtFloat64Attribute(int id, String name, boolean c, boolean e, double val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Float64 Value.
 void writeExtFloat64Attribute(int id, String name, boolean c, boolean e, double[] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Float64 Values.
 void writeExtInt16Attribute(int id, String name, boolean c, boolean e, short val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Int16 Value.
 void writeExtInt16Attribute(int id, String name, boolean c, boolean e, short[] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Int16 Values.
 void writeExtInt32Attribute(int id, String name, boolean c, boolean e, int val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Int32 Value.
 void writeExtInt32Attribute(int id, String name, boolean c, boolean e, int[] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Int32 Values.
 void writeExtInt64Attribute(int id, String name, boolean c, boolean e, long val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Int64 Value.
 void writeExtInt64Attribute(int id, String name, boolean c, boolean e, long[] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Int64 Values.
 void writeExtInt8Attribute(int id, String name, boolean c, boolean e, byte val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single int8 Value.
 void writeExtInt8Attribute(int id, String name, boolean c, boolean e, byte[] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and int8 Values.
 void writeExtOpaque12Attribute(int id, String name, boolean c, boolean e, byte[] val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque12 Value.
 void writeExtOpaque12Attribute(int id, String name, boolean c, boolean e, byte[][] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Opaque12 Values.
 void writeExtOpaque16Attribute(int id, String name, boolean c, boolean e, byte[] val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque16 Value.
 void writeExtOpaque16Attribute(int id, String name, boolean c, boolean e, byte[][] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Opaque16 Values.
 void writeExtOpaque1Attribute(int id, String name, boolean c, boolean e, byte val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque1 Value.
 void writeExtOpaque1Attribute(int id, String name, boolean c, boolean e, byte[] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Opaque1 Values.
 void writeExtOpaque2Attribute(int id, String name, boolean c, boolean e, byte[] val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque2 Value.
 void writeExtOpaque2Attribute(int id, String name, boolean c, boolean e, byte[][] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Opaque2 Values.
 void writeExtOpaque4Attribute(int id, String name, boolean c, boolean e, byte[] val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque4 Value.
 void writeExtOpaque4Attribute(int id, String name, boolean c, boolean e, byte[][] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Opaque4 Values.
 void writeExtOpaque8Attribute(int id, String name, boolean c, boolean e, byte[] val)
          Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque8 Value.
 void writeExtOpaque8Attribute(int id, String name, boolean c, boolean e, byte[][] vals)
          Writes an Extensible Attribute Element with the specified identifier/name and Opaque8 Values.
 void writeExtOpaqueAttribute(int id, String name, boolean c, boolean e, byte[] val)
          Writes an Extensible Attribute Element with the specified identifier/name and Opaque Value.
 void writeExtStringAttribute(int id, String name, boolean c, boolean e, String val)
          Writes an Extensible Attribute Element with the specified identifier/name and String Value.
 void writeFloat32Attribute(int type, float val)
          Writes a Compact Float32 Attribute Element with the specified TLV Type and a single Value.
 void writeFloat32Attribute(int type, float[] vals)
          Writes a Compact Float32 Attribute Element with the specified TLV Type and Value array.
 void writeFloat64Attribute(int type, double val)
          Writes a Compact Float64 Attribute Element with the specified TLV Type and a single Value.
 void writeFloat64Attribute(int type, double[] vals)
          Writes a Compact Float64 Attribute Element with the specified TLV Type and Value array.
 void writeInt16Attribute(int type, short val)
          Writes a Compact Int16 Attribute Element with the specified TLV Type and a single Value.
 void writeInt16Attribute(int type, short[] vals)
          Writes a Compact Int16 Attribute Element with the specified TLV Type and Value array.
 void writeInt32Attribute(int type, int val)
          Writes a Compact Int32 Attribute Element with the specified TLV Type and a single Value.
 void writeInt32Attribute(int type, int[] vals)
          Writes a Compact Int32 Attribute Element with the specified TLV Type and Value array.
 void writeInt64Attribute(int type, long val)
          Writes a Compact Int64 Attribute Element with the specified TLV Type and a single Value.
 void writeInt64Attribute(int type, long[] vals)
          Writes a Compact Int64 Attribute Element with the specified TLV Type and Value array.
 void writeInt8Attribute(int type, byte val)
          Writes a Compact Int8 Attribute Element with the specified TLV Type and Value.
 void writeInt8Attribute(int type, byte[] vals)
          Writes a Compact Int8 Attribute Element with the specified TLV Type and Value array.
 void writeOpaque12Attribute(int type, byte[] val)
          Writes a Compact Opaque12 Attribute Element with the specified TLV Type and Value.
 void writeOpaque12Attribute(int type, byte[][] vals)
          Writes a Compact Opaque12 Attribute Element with the specified TLV Type and Value array.
 void writeOpaque16Attribute(int type, byte[] val)
          Writes a Compact Opaque16 Attribute Element with the specified TLV Type and Value.
 void writeOpaque16Attribute(int type, byte[][] vals)
          Writes a Compact Opaque16 Attribute Element with the specified TLV Type and Value array.
 void writeOpaque1Attribute(int type, byte val)
          Writes a Compact Opaque1 Attribute Element with the specified TLV Type and Value.
 void writeOpaque1Attribute(int type, byte[] vals)
          Writes a Compact Opaque1 Attribute Element with the specified TLV Type and Value array.
 void writeOpaque2Attribute(int type, byte[] val)
          Writes a Compact Opaque2 Attribute Element with the specified TLV Type and a single Value.
 void writeOpaque2Attribute(int type, byte[][] vals)
          Writes a Compact Opaque2 Attribute Element with the specified TLV Type and Value array.
 void writeOpaque4Attribute(int type, byte[] val)
          Writes a Compact Opaque4 Attribute Element with the specified TLV Type and a single Value.
 void writeOpaque4Attribute(int type, byte[][] vals)
          Writes a Compact Opaque4 Attribute Element with the specified TLV Type and Value array.
 void writeOpaque8Attribute(int type, byte[] val)
          Writes a Compact Opaque8 Attribute Element with the specified TLV Type and a single Value.
 void writeOpaque8Attribute(int type, byte[][] vals)
          Writes a Compact Opaque8 Attribute Element with the specified TLV Type and Value array.
 void writeOpaqueAttribute(int type, byte[] val)
          Writes a Compact Opaque Attribute Element with the specified TLV Type and a single Value.
 void writeStringAttribute(int type, String val)
          Writes a Compact String Attribute Element with the specified TLV Type and Value.
 void writeXBE32Element(XBE32Element elem)
          Writes the specified XBE32 Element, including all their subelements if any.
 void writeXBE32Object(XBE32Writable obj)
          Writes the specified Object employing its writeXBE32Element() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XBE32Writer

public XBE32Writer(OutputStream os)
Creates a new XBE32Writer to serialize XBE32 Elements into the specified OutputStream.

Parameters:
os - the stream to write TLVs at
Method Detail

getDictionary

public XBE32Dictionary getDictionary()
Returns the dictionary employed to translate XBE32 Elements' names into a TLV Type/identifier

Returns:
the current dictionary, if any

setDictionary

public void setDictionary(XBE32Dictionary dict)
Sets the dictionary to be employed to translate XBE32 Elements' names into a TLV Type/identifier

Parameters:
dict - the new dictionary

getOpenElements

public int getOpenElements()
Returns the number of Complex Elements that have been opened, but not closed yet

Returns:
the number of open Complex Elements left

openComplexElement

public void openComplexElement(int type)
                        throws IllegalArgumentException
Writes a XBE32 Compact Complex Element with the specified TLV Type.

Parameters:
type - the Complex Element identifier
Throws:
IllegalArgumentException - If the specified id is not a Complex one
See Also:
closeComplexElement(), serialize()

openComplexElement

public void openComplexElement(int id,
                               String name,
                               boolean c,
                               boolean e)
Writes a XBE32 Extensible Complex Element with the specified identifier/name and flags.

Parameters:
id - the Complex Element identifier, or 0 if unknown
name - the Complex Element name, or null if unknown
c - the Complex Element Continue flag
e - the Complex Element Notify Error flag
See Also:
closeComplexElement(), serialize()

openComplexElement

public void openComplexElement(boolean ext,
                               int id,
                               String name,
                               boolean c,
                               boolean e)
Writes a XBE32 Extensible or Compact Complex Element with the specified identifier/name and flags.

Parameters:
ext - whether the Complex Element is an Extensible or a Compact one
id - the Complex Element identifier, or 0 if unknown
name - the Complex Element name, or null if unknown
c - the Complex Element Continue flag
e - the Complex Element Notify Error flag
See Also:
closeComplexElement(), serialize()

closeComplexElement

public void closeComplexElement()
Closes the last opened Complex Element. All Complex Elements MUST be closed in order to build a valid XBE32 stream.


writeAttribute

public void writeAttribute(int type,
                           Object val)
                    throws IllegalArgumentException
Writes a Compact Attribute Element with the specified TLV Type and Value.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtAttribute

public void writeExtAttribute(int id,
                              String name,
                              boolean c,
                              boolean e,
                              int type,
                              Object vals)
Writes an Extensible Attribute Element with the specified identifier/name and Values.

Nothing will be written if values == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
type - the Type of Attribute Values
vals - the Attribute Element Values
See Also:
XBE32Element.OPAQUE_VALUE_TYPE, XBE32Element.STRING_VALUE_TYPE, XBE32Element.OPAQUE1_VALUES_TYPE, XBE32Element.INT8_VALUES_TYPE, XBE32Element.BOOLEAN_VALUES_TYPE, XBE32Element.OPAQUE2_VALUES_TYPE, XBE32Element.INT16_VALUES_TYPE, XBE32Element.OPAQUE4_VALUES_TYPE, XBE32Element.INT32_VALUES_TYPE, XBE32Element.FLOAT32_VALUES_TYPE, XBE32Element.OPAQUE8_VALUES_TYPE, XBE32Element.INT64_VALUES_TYPE, XBE32Element.FLOAT64_VALUES_TYPE, XBE32Element.OPAQUE12_VALUES_TYPE, XBE32Element.OPAQUE16_VALUES_TYPE, serialize()

writeAttribute

public void writeAttribute(boolean ext,
                           int id,
                           String name,
                           boolean c,
                           boolean e,
                           int type,
                           Object vals)
Writes an Compact or Extensible Attribute Element with the specified identifier/name, flags, and Values.

Nothing will be written if vals == null.

Parameters:
ext - whether the Attribute is an Extensible or a Compact one
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
type - the Type of Attribute Values
vals - the Attribute Element Values
See Also:
XBE32Element.OPAQUE_VALUE_TYPE, XBE32Element.STRING_VALUE_TYPE, XBE32Element.OPAQUE1_VALUES_TYPE, XBE32Element.INT8_VALUES_TYPE, XBE32Element.BOOLEAN_VALUES_TYPE, XBE32Element.OPAQUE2_VALUES_TYPE, XBE32Element.INT16_VALUES_TYPE, XBE32Element.OPAQUE4_VALUES_TYPE, XBE32Element.INT32_VALUES_TYPE, XBE32Element.FLOAT32_VALUES_TYPE, XBE32Element.OPAQUE8_VALUES_TYPE, XBE32Element.INT64_VALUES_TYPE, XBE32Element.FLOAT64_VALUES_TYPE, XBE32Element.OPAQUE12_VALUES_TYPE, XBE32Element.OPAQUE16_VALUES_TYPE, serialize()

writeOpaqueAttribute

public void writeOpaqueAttribute(int type,
                                 byte[] val)
                          throws IllegalArgumentException
Writes a Compact Opaque Attribute Element with the specified TLV Type and a single Value.

Nothing will be written if val == null.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtOpaqueAttribute

public void writeExtOpaqueAttribute(int id,
                                    String name,
                                    boolean c,
                                    boolean e,
                                    byte[] val)
Writes an Extensible Attribute Element with the specified identifier/name and Opaque Value.

Nothing will be written if val == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeStringAttribute

public void writeStringAttribute(int type,
                                 String val)
                          throws IllegalArgumentException
Writes a Compact String Attribute Element with the specified TLV Type and Value.

Nothing will be written if val == null.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one, or it does not match with the specified Value
See Also:
serialize(), XBE32Element

writeExtStringAttribute

public void writeExtStringAttribute(int id,
                                    String name,
                                    boolean c,
                                    boolean e,
                                    String val)
Writes an Extensible Attribute Element with the specified identifier/name and String Value.

Nothing will be written if val == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeOpaque1Attribute

public void writeOpaque1Attribute(int type,
                                  byte val)
                           throws IllegalArgumentException
Writes a Compact Opaque1 Attribute Element with the specified TLV Type and Value.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeOpaque1Attribute

public void writeOpaque1Attribute(int type,
                                  byte[] vals)
                           throws IllegalArgumentException
Writes a Compact Opaque1 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtOpaque1Attribute

public void writeExtOpaque1Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     byte val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque1 Value.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtOpaque1Attribute

public void writeExtOpaque1Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     byte[] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Opaque1 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeInt8Attribute

public void writeInt8Attribute(int type,
                               byte val)
                        throws IllegalArgumentException
Writes a Compact Int8 Attribute Element with the specified TLV Type and Value.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeInt8Attribute

public void writeInt8Attribute(int type,
                               byte[] vals)
                        throws IllegalArgumentException
Writes a Compact Int8 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtInt8Attribute

public void writeExtInt8Attribute(int id,
                                  String name,
                                  boolean c,
                                  boolean e,
                                  byte val)
Writes an Extensible Attribute Element with the specified identifier/name and a single int8 Value.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtInt8Attribute

public void writeExtInt8Attribute(int id,
                                  String name,
                                  boolean c,
                                  boolean e,
                                  byte[] vals)
Writes an Extensible Attribute Element with the specified identifier/name and int8 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeBooleanAttribute

public void writeBooleanAttribute(int type,
                                  boolean val)
                           throws IllegalArgumentException
Writes a Compact Boolean Attribute Element with the specified TLV Type and a single Value.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeBooleanAttribute

public void writeBooleanAttribute(int type,
                                  boolean[] vals)
                           throws IllegalArgumentException
Writes a Compact Boolean Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtBooleanAttribute

public void writeExtBooleanAttribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     boolean val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Boolean Value.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtBooleanAttribute

public void writeExtBooleanAttribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     boolean[] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Boolean Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeOpaque2Attribute

public void writeOpaque2Attribute(int type,
                                  byte[] val)
                           throws IllegalArgumentException
Writes a Compact Opaque2 Attribute Element with the specified TLV Type and a single Value.

Nothing will be written if val == null.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeOpaque2Attribute

public void writeOpaque2Attribute(int type,
                                  byte[][] vals)
                           throws IllegalArgumentException
Writes a Compact Opaque2 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtOpaque2Attribute

public void writeExtOpaque2Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     byte[] val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque2 Value.

Nothing will be written if val == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtOpaque2Attribute

public void writeExtOpaque2Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     byte[][] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Opaque2 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeInt16Attribute

public void writeInt16Attribute(int type,
                                short val)
                         throws IllegalArgumentException
Writes a Compact Int16 Attribute Element with the specified TLV Type and a single Value.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeInt16Attribute

public void writeInt16Attribute(int type,
                                short[] vals)
                         throws IllegalArgumentException
Writes a Compact Int16 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtInt16Attribute

public void writeExtInt16Attribute(int id,
                                   String name,
                                   boolean c,
                                   boolean e,
                                   short val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Int16 Value.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtInt16Attribute

public void writeExtInt16Attribute(int id,
                                   String name,
                                   boolean c,
                                   boolean e,
                                   short[] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Int16 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeOpaque4Attribute

public void writeOpaque4Attribute(int type,
                                  byte[] val)
                           throws IllegalArgumentException
Writes a Compact Opaque4 Attribute Element with the specified TLV Type and a single Value.

Nothing will be written if val == null.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeOpaque4Attribute

public void writeOpaque4Attribute(int type,
                                  byte[][] vals)
                           throws IllegalArgumentException
Writes a Compact Opaque4 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtOpaque4Attribute

public void writeExtOpaque4Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     byte[] val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque4 Value.

Nothing will be written if val == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtOpaque4Attribute

public void writeExtOpaque4Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     byte[][] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Opaque4 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeInt32Attribute

public void writeInt32Attribute(int type,
                                int val)
                         throws IllegalArgumentException
Writes a Compact Int32 Attribute Element with the specified TLV Type and a single Value.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeInt32Attribute

public void writeInt32Attribute(int type,
                                int[] vals)
                         throws IllegalArgumentException
Writes a Compact Int32 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtInt32Attribute

public void writeExtInt32Attribute(int id,
                                   String name,
                                   boolean c,
                                   boolean e,
                                   int val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Int32 Value.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtInt32Attribute

public void writeExtInt32Attribute(int id,
                                   String name,
                                   boolean c,
                                   boolean e,
                                   int[] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Int32 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeFloat32Attribute

public void writeFloat32Attribute(int type,
                                  float val)
                           throws IllegalArgumentException
Writes a Compact Float32 Attribute Element with the specified TLV Type and a single Value.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeFloat32Attribute

public void writeFloat32Attribute(int type,
                                  float[] vals)
                           throws IllegalArgumentException
Writes a Compact Float32 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtFloat32Attribute

public void writeExtFloat32Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     float val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Float32 Value.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtFloat32Attribute

public void writeExtFloat32Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     float[] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Float32 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeOpaque8Attribute

public void writeOpaque8Attribute(int type,
                                  byte[] val)
                           throws IllegalArgumentException
Writes a Compact Opaque8 Attribute Element with the specified TLV Type and a single Value.

Nothing will be written if val == null.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeOpaque8Attribute

public void writeOpaque8Attribute(int type,
                                  byte[][] vals)
                           throws IllegalArgumentException
Writes a Compact Opaque8 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtOpaque8Attribute

public void writeExtOpaque8Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     byte[] val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque8 Value.

Nothing will be written if val == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtOpaque8Attribute

public void writeExtOpaque8Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     byte[][] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Opaque8 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeInt64Attribute

public void writeInt64Attribute(int type,
                                long val)
                         throws IllegalArgumentException
Writes a Compact Int64 Attribute Element with the specified TLV Type and a single Value.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeInt64Attribute

public void writeInt64Attribute(int type,
                                long[] vals)
                         throws IllegalArgumentException
Writes a Compact Int64 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtInt64Attribute

public void writeExtInt64Attribute(int id,
                                   String name,
                                   boolean c,
                                   boolean e,
                                   long val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Int64 Value.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtInt64Attribute

public void writeExtInt64Attribute(int id,
                                   String name,
                                   boolean c,
                                   boolean e,
                                   long[] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Int64 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeFloat64Attribute

public void writeFloat64Attribute(int type,
                                  double val)
                           throws IllegalArgumentException
Writes a Compact Float64 Attribute Element with the specified TLV Type and a single Value.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeFloat64Attribute

public void writeFloat64Attribute(int type,
                                  double[] vals)
                           throws IllegalArgumentException
Writes a Compact Float64 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtFloat64Attribute

public void writeExtFloat64Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     double val)
Writes an Extensible Attribute Element with the specified identifier/name and a single Float64 Value.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
See Also:
serialize()

writeExtFloat64Attribute

public void writeExtFloat64Attribute(int id,
                                     String name,
                                     boolean c,
                                     boolean e,
                                     double[] vals)
Writes an Extensible Attribute Element with the specified identifier/name and Float64 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
See Also:
serialize()

writeOpaque12Attribute

public void writeOpaque12Attribute(int type,
                                   byte[] val)
                            throws IllegalArgumentException
Writes a Compact Opaque12 Attribute Element with the specified TLV Type and Value.

Nothing will be written if val == null.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeOpaque12Attribute

public void writeOpaque12Attribute(int type,
                                   byte[][] vals)
                            throws IllegalArgumentException
Writes a Compact Opaque12 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtOpaque12Attribute

public void writeExtOpaque12Attribute(int id,
                                      String name,
                                      boolean c,
                                      boolean e,
                                      byte[] val)
                               throws IllegalArgumentException
Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque12 Value.

Nothing will be written if val == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
Throws:
IllegalArgumentException - if the Value is not 12 bytes long
See Also:
serialize()

writeExtOpaque12Attribute

public void writeExtOpaque12Attribute(int id,
                                      String name,
                                      boolean c,
                                      boolean e,
                                      byte[][] vals)
                               throws IllegalArgumentException
Writes an Extensible Attribute Element with the specified identifier/name and Opaque12 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
Throws:
IllegalArgumentException - if the Values are not 12 bytes long
See Also:
serialize()

writeOpaque16Attribute

public void writeOpaque16Attribute(int type,
                                   byte[] val)
                            throws IllegalArgumentException
Writes a Compact Opaque16 Attribute Element with the specified TLV Type and Value.

Nothing will be written if val == null.

Parameters:
type - the Attribute Element identifier
val - the Attribute Element Value
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeOpaque16Attribute

public void writeOpaque16Attribute(int type,
                                   byte[][] vals)
                            throws IllegalArgumentException
Writes a Compact Opaque16 Attribute Element with the specified TLV Type and Value array.

Nothing will be written if vals == null.

Parameters:
type - the Attribute Element identifier
vals - the Attribute Element Values
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one or it does not match with the specified Value
See Also:
serialize(), TLV

writeExtOpaque16Attribute

public void writeExtOpaque16Attribute(int id,
                                      String name,
                                      boolean c,
                                      boolean e,
                                      byte[] val)
                               throws IllegalArgumentException
Writes an Extensible Attribute Element with the specified identifier/name and a single Opaque16 Value.

Nothing will be written if val == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
val - the Attribute Element Value
Throws:
IllegalArgumentException - if the Value is not 16 bytes long
See Also:
serialize()

writeExtOpaque16Attribute

public void writeExtOpaque16Attribute(int id,
                                      String name,
                                      boolean c,
                                      boolean e,
                                      byte[][] vals)
                               throws IllegalArgumentException
Writes an Extensible Attribute Element with the specified identifier/name and Opaque16 Values.

Nothing will be written if vals == null.

Parameters:
id - the Attribute Element identifier
name - the Attribute Element name
c - the Attribute Element Continue flag
e - the Attribute Element Notify Error flag
vals - the Attribute Element Values
Throws:
IllegalArgumentException - if the Values are not 16 bytes long
See Also:
serialize()

writeXBE32Element

public void writeXBE32Element(XBE32Element elem)
Writes the specified XBE32 Element, including all their subelements if any.

Nothing will be written if elem == null.

Parameters:
elem - the XBE32 Element to be written
See Also:
serialize()

writeXBE32Object

public void writeXBE32Object(XBE32Writable obj)
Writes the specified Object employing its writeXBE32Element() method.

Nothing will be written if obj == null.

Parameters:
obj - the Object to be written
See Also:
serialize()

serialize

public int serialize()
              throws IOException
This method is the one that actually writes the XBE32 Element defined before into the OutputStream

Returns:
the number of bytes written
Throws:
IOException - when an error occurs writing the underlying stream