LibreOffice Module xmerge (master) 1
|
This class contains data for a single Palm database for use during a conversion process. More...
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... | |
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.
Definition at line 59 of file PalmDB.java.
|
inline |
Default constructor.
creatorID | The PDB Creator ID. |
typeID | The PDB Type ID. |
version | The PDB header version. |
attribute | The PDB header attribute. |
Definition at line 100 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.records, org.openoffice.xmerge.converter.palm.PalmDB.setAttributes(), org.openoffice.xmerge.converter.palm.PalmDB.typeID, and org.openoffice.xmerge.converter.palm.PalmDB.version.
Referenced by org.openoffice.xmerge.converter.palm.PalmDB.equals().
|
inline |
Constructor to create PalmDB
object with Record
objects.
recs.length
can be zero for an empty PDB.
name | Suggested PDB name in a String . |
creatorID | The PDB Creator ID. |
typeID | The PDB Type ID. |
version | The PDB header version. |
attribute | The PDB header attribute. |
recs | Array of Record objects. |
UnsupportedEncodingException | If name is not properly encoded. |
NullPointerException | If 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.
|
inline |
Constructor to create object with Record
objects.
recs.length
can be zero for an empty PDB.
name | Suggested PDB name in a byte array. |
creatorID | The PDB Creator ID. |
typeID | The PDB Type ID. |
version | The PDB header version. |
attribute | The PDB header attribute. |
recs | Array of Record objects. |
UnsupportedEncodingException | If name is not properly encoded. |
NullPointerException | If 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.
|
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.
obj | A PalmDB Object to compare. |
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().
|
inline |
Returns 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().
|
inline |
Returns 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().
|
inline |
Return the PDB name associated with this object in byte
array of exact length of 32 bytes.
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().
|
inline |
Return the PDB name associated with this object.
Definition at line 284 of file PalmDB.java.
References org.openoffice.xmerge.converter.palm.PalmDB.sName, and String.
Referenced by org.openoffice.xmerge.converter.palm.PalmDocument.PalmDocument(), org.openoffice.xmerge.converter.palm.PalmDocument.read(), and org.openoffice.xmerge.converter.palm.PalmDocument.setPdb().
Return the specific Record
object associated with the Record
number.
index | Record index number. |
Record
object in the specified indexArrayIndexOutOfBoundsException | If 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().
|
inline |
Return the number of Records contained in this PDB PalmDB
object.
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().
|
inline |
Return the list of Record
objects.
Record
objects. Definition at line 275 of file PalmDB.java.
References org.openoffice.xmerge.converter.palm.PalmDB.records.
|
inline |
Returns 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().
|
inline |
Returns 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().
|
inline |
Definition at line 356 of file PalmDB.java.
|
inlineprivate |
Set the attributes for the PalmDB
object.
creatorID | The PDB Creator ID. |
typeID | The PDB Type ID. |
version | The PDB header version. |
attribute | The 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().
|
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.
bytes | PDB name in byte< array. |
UnsupportedEncodingException | If 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().
|
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().
|
private |
PDB name in bytes.
Definition at line 68 of file PalmDB.java.
Referenced by org.openoffice.xmerge.converter.palm.PalmDB.equals(), org.openoffice.xmerge.converter.palm.PalmDB.getPDBNameBytes(), and org.openoffice.xmerge.converter.palm.PalmDB.store().
|
private |
Creator ID.
Definition at line 74 of file PalmDB.java.
Referenced by org.openoffice.xmerge.converter.palm.PalmDB.getCreatorID(), org.openoffice.xmerge.converter.palm.PalmDB.PalmDB(), and org.openoffice.xmerge.converter.palm.PalmDB.setAttributes().
|
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().
|
private |
List of Record
objects.
Definition at line 65 of file PalmDB.java.
Referenced by org.openoffice.xmerge.converter.palm.PalmDB.equals(), org.openoffice.xmerge.converter.palm.PalmDB.getRecord(), org.openoffice.xmerge.converter.palm.PalmDB.getRecordCount(), org.openoffice.xmerge.converter.palm.PalmDB.getRecords(), and org.openoffice.xmerge.converter.palm.PalmDB.PalmDB().
|
private |
PDB name in String.
Definition at line 71 of file PalmDB.java.
Referenced by org.openoffice.xmerge.converter.palm.PalmDB.equals(), org.openoffice.xmerge.converter.palm.PalmDB.getPDBNameString(), and org.openoffice.xmerge.converter.palm.PalmDB.store().
|
private |
Type ID.
Definition at line 77 of file PalmDB.java.
Referenced by org.openoffice.xmerge.converter.palm.PalmDB.getTypeID(), org.openoffice.xmerge.converter.palm.PalmDB.PalmDB(), and org.openoffice.xmerge.converter.palm.PalmDB.setAttributes().
|
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().