|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openoffice.xmerge.converter.palm.PalmDB
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.
PalmDocument
,
Record
Field Summary | |
static int |
NAME_LENGTH
Number of bytes for the name field in the PDB. |
static short |
PDB_HEADER_ATTR_BACKUP
|
Constructor Summary | |
PalmDB(byte[] name,
int creatorID,
int typeID,
int version,
short attribute,
Record[] recs)
Constructor to create object with Record
objects. |
|
PalmDB(int creatorID,
int typeID,
int version,
short attribute)
Default constructor. |
|
PalmDB(java.lang.String name,
int creatorID,
int typeID,
int version,
short attribute,
Record[] recs)
Constructor to create PalmDB object with
Record objects. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Override equals method of Object . |
short |
getAttribute()
Returns attribute flag. |
int |
getCreatorID()
Returns creator ID. |
byte[] |
getPDBNameBytes()
Return the PDB name associated with this object in byte array of exact length of 32 bytes. |
java.lang.String |
getPDBNameString()
Return the PDB name associated with this object. |
Record |
getRecord(int index)
Return the specific Record object associated
with the Record number. |
int |
getRecordCount()
Return the number of Records contained in this PDB PalmDB object. |
Record[] |
getRecords()
Return the list of Record objects. |
int |
getTypeID()
Returns type ID. |
int |
getVersion()
Returns version. |
void |
read(java.io.InputStream is)
Read the necessary data to create a PDB from the InputStream . |
void |
setAttributes(int creatorID,
int typeID,
int version,
short attribute)
Set the attributes for the PalmDB object. |
void |
write(java.io.OutputStream os)
Write out the number of Records followed by what will be written out by each Record object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NAME_LENGTH
public static final short PDB_HEADER_ATTR_BACKUP
Constructor Detail |
public PalmDB(byte[] name, int creatorID, int typeID, int version, short attribute, Record[] recs) throws java.io.UnsupportedEncodingException
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.java.io.UnsupportedEncodingException
- If name
is
not properly encoded.NullPointerException
- If recs is null.public PalmDB(int creatorID, int typeID, int version, short attribute)
creatorID
- The PDB Creator ID.typeID
- The PDB Type ID.version
- The PDB header version.attribute
- The PDB header attribute.public PalmDB(java.lang.String name, int creatorID, int typeID, int version, short attribute, Record[] recs) throws java.io.UnsupportedEncodingException
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.java.io.UnsupportedEncodingException
- If name
is
not properly encoded.NullPointerException
- If recs
is null.Method Detail |
public boolean equals(java.lang.Object obj)
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.equals
in class java.lang.Object
obj
- A PalmDB
Object
to
compare.obj
is equal to this, otherwise
false.public short getAttribute()
public int getCreatorID()
public byte[] getPDBNameBytes()
byte
array of exact length of 32 bytes.byte
array of
length 32.public java.lang.String getPDBNameString()
public Record getRecord(int index)
Record
object associated
with the Record
number.index
- Record
index number.Record
object in the specified indexjava.lang.ArrayIndexOutOfBoundsException
- If index is out of bounds.public int getRecordCount()
PalmDB
object.Record
objects.public Record[] getRecords()
Record
objects.Record
objects.public int getTypeID()
public int getVersion()
public void read(java.io.InputStream is) throws java.io.IOException
InputStream
.is
- The InputStream
to read data
in order to restore the object.java.io.IOException
- If any I/O error occurs.public void setAttributes(int creatorID, int typeID, int version, short attribute)
PalmDB
object.creatorID
- The PDB Creator ID.typeID
- The PDB Type ID.version
- The PDB header version.attribute
- The PDB header attribute.public void write(java.io.OutputStream os) throws java.io.IOException
Record
object.os
- The OutputStream
to write the
object.java.io.IOException
- If any I/O error occurs.
|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |