net.sf.cb2java.copybook
Class Copybook

java.lang.Object
  extended bynet.sf.cb2java.copybook.Element
      extended bynet.sf.cb2java.copybook.Group
          extended bynet.sf.cb2java.copybook.Copybook

public class Copybook
extends Group

Represents a copybook data definition in memory

acts as a Group element but as a special parent being the copybook itself

Author:
James Watson

Nested Class Summary
static class Copybook.ByteBuffer
          a helper class for buffering the data as it is processed
 
Field Summary
static java.lang.String DEFAULT_ENCODING
           
static java.lang.String DEFAULT_FLOAT_CONVERSION
           
static boolean DEFAULT_LITTLE_ENDIAN
           
protected  net.sf.cb2java.copybook.Values values
           
 
Method Summary
 Record createNew()
          creates a new empty application data instance
 Element getAliased(java.lang.String name)
          Gets an aliased element.
 java.lang.String getEncoding()
          retrieves the current encoding for the copybook
 java.lang.String getFloatConversion()
           
 boolean getLittleEndian()
           
 Record parseData(byte[] data)
          creates a new application data element with the given data
 Record parseData(java.io.InputStream reader)
          creates a new application data element with the given data
 void setEncoding(java.lang.String encoding)
          Sets the encoding for the copybook instance, used for parsing and writing of data
 void setFloatConversion(java.lang.String className)
           
 void setLittleEndian(boolean littleEndian)
           
 
Methods inherited from class net.sf.cb2java.copybook.Group
getChildren, getLength, getValue, setValue, setValue, toBytes, toString, validate
 
Methods inherited from class net.sf.cb2java.copybook.Element
getBytes, getLevel, getName, getOccurs, getPosition, getString, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_ENCODING

public static final java.lang.String DEFAULT_ENCODING

DEFAULT_LITTLE_ENDIAN

public static final boolean DEFAULT_LITTLE_ENDIAN

DEFAULT_FLOAT_CONVERSION

public static final java.lang.String DEFAULT_FLOAT_CONVERSION

values

protected net.sf.cb2java.copybook.Values values
Method Detail

getAliased

public Element getAliased(java.lang.String name)
Gets an aliased element. This behavior is partial, untested and not officially supported (yet)

Parameters:
name - i'm not even sure anymore
Returns:
who knows?

createNew

public Record createNew()
creates a new empty application data instance

Returns:
a new empty application data instance

parseData

public Record parseData(byte[] data)
                 throws java.io.IOException
creates a new application data element with the given data

Parameters:
data - the data to create the instance for
Returns:
a new application data element with the given data
Throws:
java.io.IOException

parseData

public Record parseData(java.io.InputStream reader)
                 throws java.io.IOException
creates a new application data element with the given data

Parameters:
reader - the data to create the instance for
Returns:
a new application data element with the given data
Throws:
java.io.IOException

setEncoding

public void setEncoding(java.lang.String encoding)
Sets the encoding for the copybook instance, used for parsing and writing of data

Parameters:
encoding - the encoding for the system

getEncoding

public java.lang.String getEncoding()
retrieves the current encoding for the copybook

Returns:

setLittleEndian

public void setLittleEndian(boolean littleEndian)

getLittleEndian

public boolean getLittleEndian()

setFloatConversion

public void setFloatConversion(java.lang.String className)

getFloatConversion

public java.lang.String getFloatConversion()