com.partnersoft.io.formats.packrat
Class PackratArray

java.lang.Object
  extended by com.partnersoft.io.formats.packrat.PackratDatatype
      extended by com.partnersoft.io.formats.packrat.PackratArray
All Implemented Interfaces:
PackratConstants, java.io.Serializable

public class PackratArray
extends PackratDatatype

An array in the Packrat format.

Author:
Paul Reavis Copyright 2002 Partner Software, Inc.
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.partnersoft.io.formats.packrat.PackratDatatype
EMPTY_TYPE_ARRAY, sizeParam
 
Fields inherited from interface com.partnersoft.io.formats.packrat.PackratConstants
DATATYPE_ARRAY, DATATYPE_ASSOC, DATATYPE_BLOB, DATATYPE_FLAG_COLLECTION, DATATYPE_FLAG_FIXED, DATATYPE_FLAG_STRUCT, DATATYPE_FLAG_VARIABLE, DATATYPE_FLOAT, DATATYPE_INT, DATATYPE_LIST, DATATYPE_STRING, DATATYPE_STRUCT, DATATYPE_UINT
 
Constructor Summary
PackratArray()
           
PackratArray(int sizeParam, PackratDatatype contentsType)
           
PackratArray(java.lang.String name, int sizeParam, PackratDatatype contentsType)
           
 
Method Summary
 java.lang.Object bytesToObject(ByteBuffer input)
          Convert the given bytes to an appropriate object representation.
 PackratDatatype getContentsType()
           
 PackratDatatype[] getSubtypes()
          Return a list of any subtypes.
 int getTypeCode()
          Return a single-byte code for the type.
 java.lang.String getTypeDescription()
          Return a String description of the data type (e.g.
 boolean isFixedSize()
          If true, datatype requires a fixed number of bytes.
 void objectToBytes(java.lang.Object input, ByteBuffer output)
          Convert the given object to its binary representation.
 void setContentsType(PackratDatatype newType)
           
 java.util.List viewFileAsList(PackratRandomAccessReader filet)
           
 
Methods inherited from class com.partnersoft.io.formats.packrat.PackratDatatype
appendAllTypes, getFixedSizeAmount, getFullDescription, getName, getSizeParam, objectToByteArray, objectToByteBuffer, objectToBytes, readSize, setName, setSizeParam, toString, writeSize, writeSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PackratArray

public PackratArray()

PackratArray

public PackratArray(int sizeParam,
                    PackratDatatype contentsType)

PackratArray

public PackratArray(java.lang.String name,
                    int sizeParam,
                    PackratDatatype contentsType)
Method Detail

getTypeCode

public int getTypeCode()
Description copied from class: PackratDatatype
Return a single-byte code for the type. Must be unique. Valid codes are defined in PackratConstants.

Specified by:
getTypeCode in class PackratDatatype

getTypeDescription

public java.lang.String getTypeDescription()
Description copied from class: PackratDatatype
Return a String description of the data type (e.g. "String", "UInt16", etc.)

Specified by:
getTypeDescription in class PackratDatatype

isFixedSize

public boolean isFixedSize()
Description copied from class: PackratDatatype
If true, datatype requires a fixed number of bytes.

Specified by:
isFixedSize in class PackratDatatype

objectToBytes

public void objectToBytes(java.lang.Object input,
                          ByteBuffer output)
Description copied from class: PackratDatatype
Convert the given object to its binary representation. Throws IllegalArgumentException if it doesn't like the input.

Specified by:
objectToBytes in class PackratDatatype

bytesToObject

public java.lang.Object bytesToObject(ByteBuffer input)
Description copied from class: PackratDatatype
Convert the given bytes to an appropriate object representation. Throws IllegalArgumentException if it doesn't like the input.

Specified by:
bytesToObject in class PackratDatatype

viewFileAsList

public java.util.List viewFileAsList(PackratRandomAccessReader filet)
                              throws java.io.IOException
Throws:
java.io.IOException

getContentsType

public PackratDatatype getContentsType()

setContentsType

public void setContentsType(PackratDatatype newType)

getSubtypes

public PackratDatatype[] getSubtypes()
Description copied from class: PackratDatatype
Return a list of any subtypes. Defaults to an empty array. Subtypes are any datatypes that are part of this type - for example, fields in a structure or values in a list.

Overrides:
getSubtypes in class PackratDatatype