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 PalmDB object with Record objects. More...
 
 PalmDB (byte[] name, int creatorID, int typeID, int version, short attribute, Record[] recs) throws UnsupportedEncodingException
 Constructor to create object with Record objects. 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 PalmDB object. More...
 
Record getRecord (int index)
 Return the specific Record object associated with the Record number. More...
 
Record[] getRecords ()
 Return the list of Record objects. More...
 
String getPDBNameString ()
 Return the PDB name associated with this object. More...
 
byte[] getPDBNameBytes ()
 Return the PDB name associated with this object in byte array of exact length of 32 bytes. More...
 
boolean equals (Object obj)
 Override equals method of Object. 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 PalmDB object. More...
 
void store (byte[] bytes) throws UnsupportedEncodingException
 This private method is mainly used by the constructors above. More...
 

Private Attributes

Record[] records
 List of Record objects. 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 Record objects stored in an array. The index of the Record object in the array is the Record id or number for that specific Record 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 String or byte array are converted to an exact NAME_LENGTH byte array. If the length of the name is less than NAME_LENGTH, 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 bName, and a corresponding String object sName 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

◆ PalmDB() [1/3]

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

◆ PalmDB() [2/3]

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 PalmDB object with Record objects.

recs.length can be zero for an empty PDB.

Parameters
nameSuggested PDB name in a String.
creatorIDThe PDB Creator ID.
typeIDThe PDB Type ID.
versionThe PDB header version.
attributeThe PDB header attribute.
recsArray of Record objects.
Exceptions
UnsupportedEncodingExceptionIf name 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.

◆ PalmDB() [3/3]

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 Record objects.

recs.length can be zero for an empty PDB.

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

Definition at line 145 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.records, org.openoffice.xmerge.converter.palm.PalmDB.setAttributes(), org.openoffice.xmerge.converter.palm.PalmDB.store(), System, org.openoffice.xmerge.converter.palm.PalmDB.typeID, and org.openoffice.xmerge.converter.palm.PalmDB.version.

Member Function Documentation

◆ equals()

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

Override equals method of Object.

Two PalmDB 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 PalmDB Object 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, org.openoffice.xmerge.converter.palm.PalmDB.equals(), i, org.openoffice.xmerge.converter.palm.PalmDB.PalmDB(), org.openoffice.xmerge.converter.palm.PalmDB.records, and org.openoffice.xmerge.converter.palm.PalmDB.sName.

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

◆ getAttribute()

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().

◆ getCreatorID()

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().

◆ getPDBNameBytes()

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

Return the PDB name associated with this object in byte array of exact length of 32 bytes.

Returns
The PDB name in byte 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().

◆ getPDBNameString()

String org.openoffice.xmerge.converter.palm.PalmDB.getPDBNameString ( )
inline

◆ getRecord()

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

Return the specific Record object associated with the Record number.

Parameters
indexRecord index number.
Returns
The Record object in the specified index
Exceptions
ArrayIndexOutOfBoundsExceptionIf index is out of bounds.

Definition at line 266 of file PalmDB.java.

References index, and org.openoffice.xmerge.converter.palm.PalmDB.records.

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

◆ getRecordCount()

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

Return the number of Records contained in this PDB PalmDB object.

Returns
Number of Record objects.

Definition at line 252 of file PalmDB.java.

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

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

◆ getRecords()

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

Return the list of Record objects.

Returns
The array of Record objects.

Definition at line 275 of file PalmDB.java.

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

◆ getTypeID()

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().

◆ getVersion()

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().

◆ hashCode()

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

Definition at line 356 of file PalmDB.java.

◆ setAttributes()

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

Set the attributes for the PalmDB 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().

◆ store()

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 String representation, and also by the read method.

TODO: Note that this method assumes that the byte array parameter contains one character per byte, else it would truncate improperly.

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

Definition at line 186 of file PalmDB.java.

References org.openoffice.xmerge.converter.palm.PalmDB.bName, i, org.openoffice.xmerge.converter.palm.PalmDB.NAME_LENGTH, org.openoffice.xmerge.converter.palm.PalmDB.sName, and String.

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

Member Data Documentation

◆ attribute

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().

◆ bName

byte [] org.openoffice.xmerge.converter.palm.PalmDB.bName = null
private

◆ creatorID

int org.openoffice.xmerge.converter.palm.PalmDB.creatorID = 0
private

◆ NAME_LENGTH

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().

◆ records

Record [] org.openoffice.xmerge.converter.palm.PalmDB.records
private

◆ sName

String org.openoffice.xmerge.converter.palm.PalmDB.sName = null
private

◆ typeID

int org.openoffice.xmerge.converter.palm.PalmDB.typeID = 0
private

◆ version

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: