com.partnersoft.v3x.io.formats
Class DBFFile

java.lang.Object
  extended by com.partnersoft.v3x.io.formats.ObjectDatafile
      extended by com.partnersoft.v3x.io.formats.DBFFile

public class DBFFile
extends ObjectDatafile

a dbf file. tell me things about myself and watch me write records and headers and such! before writing anything make sure the number of records, and all the DBFFieldDescriptors are set or the header will be bogus/worthless.. enjoy.


Constructor Summary
DBFFile(java.lang.String filename)
           
 
Method Summary
 java.util.ArrayList getFieldDescriptors()
           
 java.io.RandomAccessFile getFile()
          If you just have to bang on the file, use this.
 int getNumberOfRecords()
           
 boolean getStripString()
           
protected  void readRecordImp(java.lang.Object recycleMe, java.io.RandomAccessFile filet)
          Subclasses must override this to read an object from the fixed-length format, given an object to put the results into.
protected  java.lang.Object readRecordImp(java.io.RandomAccessFile filet)
          Subclasses must override this to read an object from the fixed-length format.
 void setFieldDescriptors(java.util.ArrayList newFieldDescriptors)
           
 void setNumberOfRecords(int newNumber)
           
 void setStripString(boolean newValue)
           
 void updateHeader(int numberOfRecords, java.io.RandomAccessFile filet)
           
 void writeEOFByte()
           
 void writeHeader()
           
 void writeHeaderImp(java.lang.Object header, java.io.RandomAccessFile filet)
          a (version 3?) dbf header
 void writeRecord(java.lang.Object source)
           
 void writeRecordImp(java.lang.Object source, java.io.RandomAccessFile filet)
          Subclasses must override this to write out the object in the desired form.
 
Methods inherited from class com.partnersoft.v3x.io.formats.ObjectDatafile
appendRecord, clear, close, compare, compare, compareImp, compareImp, findClosest, getHeaderSize, getRecordSize, getSize, openRead, openWrite, readHeader, readHeaderImp, readKey, readKeyImp, readRecord, readRecord, search, setHeaderSize, setRecordSize, sort, writeHeader, writeRecord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBFFile

public DBFFile(java.lang.String filename)
Method Detail

writeRecord

public void writeRecord(java.lang.Object source)
                 throws java.io.IOException
Throws:
java.io.IOException

writeRecordImp

public void writeRecordImp(java.lang.Object source,
                           java.io.RandomAccessFile filet)
                    throws java.io.IOException
Description copied from class: ObjectDatafile
Subclasses must override this to write out the object in the desired form. The RandomAccessFile is advanced to the correct spot; just write away.

Specified by:
writeRecordImp in class ObjectDatafile
Throws:
java.io.IOException

readRecordImp

protected java.lang.Object readRecordImp(java.io.RandomAccessFile filet)
Description copied from class: ObjectDatafile
Subclasses must override this to read an object from the fixed-length format. The RandomAccessFile is advanced to the correct spot; just read away.

Specified by:
readRecordImp in class ObjectDatafile

readRecordImp

protected void readRecordImp(java.lang.Object recycleMe,
                             java.io.RandomAccessFile filet)
Description copied from class: ObjectDatafile
Subclasses must override this to read an object from the fixed-length format, given an object to put the results into. Quite often, for speed, you don't want to create objects, but reuse them instead. This allows you to do that.

The RandomAccessFile is advanced to the correct spot; just read away.

Specified by:
readRecordImp in class ObjectDatafile

writeHeader

public void writeHeader()
                 throws java.io.IOException
Throws:
java.io.IOException

updateHeader

public void updateHeader(int numberOfRecords,
                         java.io.RandomAccessFile filet)

writeHeaderImp

public void writeHeaderImp(java.lang.Object header,
                           java.io.RandomAccessFile filet)
                    throws java.io.IOException
a (version 3?) dbf header

Overrides:
writeHeaderImp in class ObjectDatafile
Throws:
java.io.IOException

writeEOFByte

public void writeEOFByte()
                  throws java.io.IOException
Throws:
java.io.IOException

getFile

public java.io.RandomAccessFile getFile()
Description copied from class: ObjectDatafile
If you just have to bang on the file, use this. Be careful, dammit!

Overrides:
getFile in class ObjectDatafile

setNumberOfRecords

public void setNumberOfRecords(int newNumber)

getNumberOfRecords

public int getNumberOfRecords()

setFieldDescriptors

public void setFieldDescriptors(java.util.ArrayList newFieldDescriptors)

getFieldDescriptors

public java.util.ArrayList getFieldDescriptors()

setStripString

public void setStripString(boolean newValue)

getStripString

public boolean getStripString()