LibreOffice Module xmerge (master)  1
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
org.openoffice.xmerge.converter.palm.PalmDB Class Reference

This class contains data for a single Palm database for use during a conversion process. More...

Collaboration diagram for org.openoffice.xmerge.converter.palm.PalmDB:
[legend]

Public Member Functions

 PalmDB (int creatorID, int typeID, int version, short attribute)
 Default constructor. More...
 
 PalmDB (String name, int creatorID, int typeID, int version, short attribute, Record[] recs) throws UnsupportedEncodingException
 Constructor to create. More...
 
 PalmDB (byte[] name, int creatorID, int typeID, int version, short attribute, Record[] recs) throws UnsupportedEncodingException
 Constructor to create object with. More...
 
int getCreatorID ()
 Returns creator ID. More...
 
int getTypeID ()
 Returns type ID. More...
 
short getAttribute ()
 Returns attribute flag. More...
 
int getVersion ()
 Returns version. More...
 
int getRecordCount ()
 Return the number of Records contained in this PDB. More...
 
Record getRecord (int index)
 Return the specific. More...
 
Record[] getRecords ()
 Return the list of. More...
 
String getPDBNameString ()
 Return the PDB name associated with this object. More...
 
byte[] getPDBNameBytes ()
 Return the PDB name associated with this object in. More...
 
boolean equals (Object obj)
 Override equals method of. More...
 
int hashCode ()
 

Static Public Attributes

static final int NAME_LENGTH = 32
 Number of bytes for the name field in the PDB. More...
 

Private Member Functions

void setAttributes (int creatorID, int typeID, int version, short attribute)
 Set the attributes for the. More...
 
void store (byte[] bytes) throws UnsupportedEncodingException
 This private method is mainly used by the constructors above. More...
 

Private Attributes

Record[] records
 List of. More...
 
byte[] bName = null
 PDB name in bytes. More...
 
String sName = null
 PDB name in String. More...
 
int creatorID = 0
 Creator ID. More...
 
int typeID = 0
 Type ID. More...
 
int version = 0
 PDB version. More...
 
short attribute = 0
 PDB attribute - flags for the database. More...
 

Detailed Description

This class contains data for a single Palm database for use during a conversion process.

It contains zero or more

objects stored in an array. The index of the

object in the array is the

id or number for that specific

object. Note that this class does not check for maximum number of Records allowable in an actual PDB.

This class also contains the PDB name associated with the Palm database it represents. A PDB name consists of 32 bytes of a certain encoding (extended ASCII in this case).

The non default constructors take in a name parameter which may not be the exact PDB name to be used. The name parameter in

or

array are converted to an exact

byte array. If the length of the name is less than

, it is padded with

'\0'

characters. If it is more, it gets truncated. The last character in the resulting byte array is always a

'\0'

character. The resulting byte array is stored in

, and a corresponding

object

that contains characters without the

'\0'

characters.

The

write

method is called within the PalmDocument.write method for writing out its data to the

OutputStream

object.

The

read

method is called within the PalmDocument.read method for reading in its data from the

InputStream

object.

See also
PalmDocument
Record

Definition at line 59 of file PalmDB.java.

Constructor & Destructor Documentation

org.openoffice.xmerge.converter.palm.PalmDB.PalmDB ( int  creatorID,
int  typeID,
int  version,
short  attribute 
)
inline

Default constructor.

Parameters
creatorIDThe PDB Creator ID.
typeIDThe PDB Type ID.
versionThe PDB header version.
attributeThe PDB header attribute.

Definition at line 100 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.setAttributes().

Referenced by org.openoffice.xmerge.converter.palm.PalmDB.equals().

org.openoffice.xmerge.converter.palm.PalmDB.PalmDB ( String  name,
int  creatorID,
int  typeID,
int  version,
short  attribute,
Record[]  recs 
) throws UnsupportedEncodingException
inline

Constructor to create.

object with

objects.

recs.length

can be zero for an empty PDB.

Parameters
nameSuggested PDB name in a .
creatorIDThe PDB Creator ID.
typeIDThe PDB Type ID.
versionThe PDB header version.
attributeThe PDB header attribute.
recsArray of objects.
Exceptions
UnsupportedEncodingExceptionIf is not properly encoded.
NullPointerExceptionIf
recs
is
null
.

Definition at line 121 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.attribute, org.openoffice.xmerge.converter.palm.PalmDB.creatorID, name, org.openoffice.xmerge.converter.palm.PalmDB.typeID, and org.openoffice.xmerge.converter.palm.PalmDB.version.

org.openoffice.xmerge.converter.palm.PalmDB.PalmDB ( byte[]  name,
int  creatorID,
int  typeID,
int  version,
short  attribute,
Record[]  recs 
) throws UnsupportedEncodingException
inline

Constructor to create object with.

objects.

recs.length

can be zero for an empty PDB.

Parameters
nameSuggested PDB name in a array.
creatorIDThe PDB Creator ID.
typeIDThe PDB Type ID.
versionThe PDB header version.
attributeThe PDB header attribute.
recsArray of objects.
Exceptions
UnsupportedEncodingExceptionIf is not properly encoded.
NullPointerExceptionIf
recs
is
null
.

Definition at line 145 of file PalmDB.java.

References name, org.openoffice.xmerge.converter.palm.PalmDB.setAttributes(), org.openoffice.xmerge.converter.palm.PalmDB.store(), and System.

Member Function Documentation

boolean org.openoffice.xmerge.converter.palm.PalmDB.equals ( Object  obj)
inline

Override equals method of.

.

Two

objects are equal if they contain the same information, i.e. PDB name and Records.

This is used primarily for testing purposes only for now.

Parameters
objA to compare.
Returns
true
if
obj
is equal to this, otherwise
false
.

Definition at line 312 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.bName, i, org.openoffice.xmerge.converter.palm.PalmDB.PalmDB(), org.openoffice.xmerge.converter.palm.PalmDB.records, and org.openoffice.xmerge.converter.palm.PalmDB.sName.

short org.openoffice.xmerge.converter.palm.PalmDB.getAttribute ( )
inline

Returns attribute flag.

Returns
The attribute flag.

Definition at line 234 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.attribute.

Referenced by org.openoffice.xmerge.converter.palm.PdbEncoder.PdbEncoder().

int org.openoffice.xmerge.converter.palm.PalmDB.getCreatorID ( )
inline

Returns creator ID.

Returns
The creator ID.

Definition at line 216 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.creatorID.

Referenced by org.openoffice.xmerge.converter.palm.PdbEncoder.PdbEncoder().

byte [] org.openoffice.xmerge.converter.palm.PalmDB.getPDBNameBytes ( )
inline

Return the PDB name associated with this object in.

array of exact length of 32 bytes.

Returns
The PDB name in array of length 32.

Definition at line 294 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.bName.

Referenced by org.openoffice.xmerge.converter.palm.PdbEncoder.PdbEncoder().

String org.openoffice.xmerge.converter.palm.PalmDB.getPDBNameString ( )
inline
Record org.openoffice.xmerge.converter.palm.PalmDB.getRecord ( int  index)
inline

Return the specific.

object associated with the

number.

Parameters
index

Definition at line 266 of file PalmDB.java.

Referenced by org.openoffice.xmerge.converter.palm.PdbEncoder.write().

int org.openoffice.xmerge.converter.palm.PalmDB.getRecordCount ( )
inline

Return the number of Records contained in this PDB.

object.

Returns
Number of objects.

Definition at line 252 of file PalmDB.java.

Referenced by org.openoffice.xmerge.converter.palm.PdbEncoder.PdbEncoder().

Record [] org.openoffice.xmerge.converter.palm.PalmDB.getRecords ( )
inline

Return the list of.

objects.

Returns
The array of objects.

Definition at line 275 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.records.

int org.openoffice.xmerge.converter.palm.PalmDB.getTypeID ( )
inline

Returns type ID.

Returns
The type ID.

Definition at line 225 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.typeID.

Referenced by org.openoffice.xmerge.converter.palm.PdbEncoder.PdbEncoder().

int org.openoffice.xmerge.converter.palm.PalmDB.getVersion ( )
inline

Returns version.

Returns
The version.

Definition at line 243 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.version.

Referenced by org.openoffice.xmerge.converter.palm.PdbEncoder.PdbEncoder().

int org.openoffice.xmerge.converter.palm.PalmDB.hashCode ( )
inline

Definition at line 356 of file PalmDB.java.

void org.openoffice.xmerge.converter.palm.PalmDB.setAttributes ( int  creatorID,
int  typeID,
int  version,
short  attribute 
)
inlineprivate

Set the attributes for the.

object.

Parameters
creatorIDThe PDB Creator ID.
typeIDThe PDB Type ID.
versionThe PDB header version.
attributeThe PDB header attribute.

Definition at line 164 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.attribute, org.openoffice.xmerge.converter.palm.PalmDB.creatorID, org.openoffice.xmerge.converter.palm.PalmDB.typeID, and org.openoffice.xmerge.converter.palm.PalmDB.version.

Referenced by org.openoffice.xmerge.converter.palm.PalmDB.PalmDB().

void org.openoffice.xmerge.converter.palm.PalmDB.store ( byte[]  bytes) throws UnsupportedEncodingException
inlineprivate

This private method is mainly used by the constructors above.

to store bytes into name and also create a

representation, and also by the

read

method.

TODO: Note that this method assumes that the

array parameter contains one character per

, else it would truncate improperly.

Parameters
bytesPDB name in array.
Exceptions
UnsupportedEncodingExceptionIf ENCODING is not supported.

Definition at line 186 of file PalmDB.java.

References for(), i, org.openoffice.xmerge.converter.palm.PalmDB.NAME_LENGTH, and String.

Referenced by org.openoffice.xmerge.converter.palm.PalmDB.PalmDB().

Member Data Documentation

short org.openoffice.xmerge.converter.palm.PalmDB.attribute = 0
private

PDB attribute - flags for the database.

Palm UInt16. Unsignedness should be irrelevant.

Definition at line 90 of file PalmDB.java.

Referenced by org.openoffice.xmerge.converter.palm.PalmDB.getAttribute(), org.openoffice.xmerge.converter.palm.PalmDB.PalmDB(), and org.openoffice.xmerge.converter.palm.PalmDB.setAttributes().

byte [] org.openoffice.xmerge.converter.palm.PalmDB.bName = null
private
int org.openoffice.xmerge.converter.palm.PalmDB.creatorID = 0
private
final int org.openoffice.xmerge.converter.palm.PalmDB.NAME_LENGTH = 32
static

Number of bytes for the name field in the PDB.

Definition at line 62 of file PalmDB.java.

Referenced by org.openoffice.xmerge.converter.palm.PalmDB.store().

Record [] org.openoffice.xmerge.converter.palm.PalmDB.records
private
String org.openoffice.xmerge.converter.palm.PalmDB.sName = null
private
int org.openoffice.xmerge.converter.palm.PalmDB.typeID = 0
private
int org.openoffice.xmerge.converter.palm.PalmDB.version = 0
private

PDB version.

Palm UInt16. It is treated as a number here, since there is no unsigned 16 bit in Java,

int

is used instead, but only 2 bytes are written out or read in.

Definition at line 84 of file PalmDB.java.

Referenced by org.openoffice.xmerge.converter.palm.PalmDB.getVersion(), org.openoffice.xmerge.converter.palm.PalmDB.PalmDB(), and org.openoffice.xmerge.converter.palm.PalmDB.setAttributes().


The documentation for this class was generated from the following file: