com.partnersoft.io.formats.packrat
Class PackratAssociation

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

public class PackratAssociation
extends PackratDatatype

An association in the Packrat format. Does not have to be one-to-one.

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
PackratAssociation()
           
PackratAssociation(PackratArray keyArrayType, PackratArray valueArrayType)
           
PackratAssociation(java.lang.String name, PackratArray keyArrayType, PackratArray valueArrayType)
           
 
Method Summary
 java.lang.Object bytesToObject(ByteBuffer input)
          Convert the given bytes to an appropriate object representation.
 PackratArray getKeyArrayType()
           
 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.
 PackratArray getValueArrayType()
           
 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 setKeyArrayType(PackratArray newType)
           
 void setValueArrayType(PackratArray newType)
           
 java.util.List[] viewFileAsLists(PackratRandomAccessReader reader)
           
 java.util.Map viewFileAsMap(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

PackratAssociation

public PackratAssociation()

PackratAssociation

public PackratAssociation(PackratArray keyArrayType,
                          PackratArray valueArrayType)

PackratAssociation

public PackratAssociation(java.lang.String name,
                          PackratArray keyArrayType,
                          PackratArray valueArrayType)
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

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

viewFileAsMap

public java.util.Map viewFileAsMap(PackratRandomAccessReader filet)
                            throws java.io.IOException
Throws:
java.io.IOException

viewFileAsLists

public java.util.List[] viewFileAsLists(PackratRandomAccessReader reader)
                                 throws java.io.IOException
Throws:
java.io.IOException

getValueArrayType

public PackratArray getValueArrayType()

setValueArrayType

public void setValueArrayType(PackratArray newType)

getKeyArrayType

public PackratArray getKeyArrayType()

setKeyArrayType

public void setKeyArrayType(PackratArray newType)