dk.vajhoej.record
Class StructWriter

java.lang.Object
  extended by dk.vajhoej.record.StructWriter

public class StructWriter
extends java.lang.Object

Class StructWriter writes a Java object to a byte array as a native struct.


Constructor Summary
StructWriter()
          Construct instance of StructWriter with default buffer size.
StructWriter(int bufsiz)
          Construct instance of StructWriter.
 
Method Summary
 byte[] getBytes()
          Get bytes.
 void write(java.lang.Object o)
          Write.
 void write(java.lang.Object o, LengthProvider lenpvd)
          Write.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructWriter

public StructWriter()
Construct instance of StructWriter with default buffer size.


StructWriter

public StructWriter(int bufsiz)
Construct instance of StructWriter.

Parameters:
bufsiz - size of byte array to write to
Method Detail

write

public void write(java.lang.Object o)
           throws RecordException
Write.

Parameters:
o - object to write
Throws:
RecordException - if impossible to convert between types in class and struct

write

public void write(java.lang.Object o,
                  LengthProvider lenpvd)
           throws RecordException
Write.

Parameters:
o - object to write
lenpvd - supplies length for fields where it is not given
Throws:
RecordException - if impossible to convert between types in class and struct

getBytes

public byte[] getBytes()
Get bytes.

Returns:
the resulting byte array