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

Provides functionality to encode a PalmDB object into a PDB formatted file given a file OutputStream. More...

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

Public Member Functions

 PdbEncoder (PalmDB db)
 Constructor. More...
 
void write (OutputStream os) throws IOException
 Write out a PDB into the given OutputStream. More...
 

Private Attributes

final PdbHeader header
 PDB header. More...
 
final PalmDB db
 the PalmDB object. More...
 

Static Private Attributes

static final int START_UNIQUE_ID = 0x00BABE
 The pattern for unique_id=0x00BABE(start). More...
 

Detailed Description

Provides functionality to encode a PalmDB object into a PDB formatted file given a file OutputStream.

This class is only used by the PalmDB object.

One needs to create one PdbEncoder object per PalmDB object to be encoded. This class keeps the PDB header data and functionality in the PdbHeader class.

Sample usage:

PdbEncoder encoder = new PdbEncoder(palmDB, "STRW", "data");
encoder.write(new FileOutputStream("sample.pdb"));
See also
PalmDB
Record

Definition at line 44 of file PdbEncoder.java.

Constructor & Destructor Documentation

◆ PdbEncoder()

org.openoffice.xmerge.converter.palm.PdbEncoder.PdbEncoder ( PalmDB  db)
inline

Member Function Documentation

◆ write()

void org.openoffice.xmerge.converter.palm.PdbEncoder.write ( OutputStream  os) throws IOException
inline

Write out a PDB into the given OutputStream.

First, write out the header data by using the PdbHeader.write method. Next, calculate the RecordList section and write it out. Lastly, write out the bytes corresponding to each Record.

The RecordList section contains a list of Record index info, where each Record index info contains:

  • 4 bytes local offset of the Record from the top of the PDB.
  • 1 byte of Record attribute.
  • 3 bytes unique Record ID.

There should be a total of header.numRecords of Record index info.

Parameters
osOutputStream to write out PDB.
Exceptions
IOExceptionIf I/O error occurs.

Definition at line 106 of file PdbEncoder.java.

References org.openoffice.xmerge.converter.palm.PdbEncoder.db, org.openoffice.xmerge.converter.palm.Record.getAttributes(), org.openoffice.xmerge.converter.palm.Record.getBytes(), org.openoffice.xmerge.converter.palm.PalmDB.getRecord(), org.openoffice.xmerge.converter.palm.Record.getSize(), org.openoffice.xmerge.converter.palm.PdbEncoder.header, i, size, and org.openoffice.xmerge.converter.palm.PdbEncoder.START_UNIQUE_ID.

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

Member Data Documentation

◆ db

final PalmDB org.openoffice.xmerge.converter.palm.PdbEncoder.db
private

◆ header

final PdbHeader org.openoffice.xmerge.converter.palm.PdbEncoder.header
private

◆ START_UNIQUE_ID

final int org.openoffice.xmerge.converter.palm.PdbEncoder.START_UNIQUE_ID = 0x00BABE
staticprivate

The pattern for unique_id=0x00BABE(start).

Definition at line 53 of file PdbEncoder.java.

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


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