OpenOffice.org
XMerge API

org.openoffice.xmerge.converter.palm
Class PdbEncoder

java.lang.Object
  |
  +--org.openoffice.xmerge.converter.palm.PdbEncoder

public final class PdbEncoder
extends java.lang.Object

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

Constructor Summary
PdbEncoder(PalmDB db)
          Constructor.
 
Method Summary
 void write(java.io.OutputStream os)
          Write out a PDB into the given OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdbEncoder

public PdbEncoder(PalmDB db)
Constructor.
Parameters:
db - The PalmDB to be encoded.
Method Detail

write

public void write(java.io.OutputStream os)
           throws java.io.IOException

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:

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

.
Parameters:
os - OutputStream to write out PDB.
Throws:
java.io.IOException - If I/O error occurs.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org