dbfeditor.data
Class DBFTable

java.lang.Object
  extended by dbfeditor.data.DBFTable

public class DBFTable
extends java.lang.Object

DBTable - Objects of this class would be used to store all of the data found in a single .dbf file. Note that the columns data would be stored in fields and records, just as in a database table.

Author:
Richard McKenna

Constructor Summary
DBFTable()
          This default constructor simply sets up the fields and records vectors.
 
Method Summary
 void addField(DBFField dbf)
          This method adds a Field.
 void addRecord(DBFRecord dbr)
          This method adds a record.
 java.util.Iterator<DBFField> fieldsIterator()
          This method returns an iterator for all the field data.
 byte getCodePageMark()
          This method returns the code page mark.
 short getDataRecordLength()
          This method returns the data record length.
 byte getDbaseEncryptionFlag()
          This method returns the database encryption flag.
 byte getDbaseTransactionFlag()
          This method returns the database transaction flag.
 DBFField getField(int index)
          This method returns the field at a given index.
 byte getFileType()
          This method returns the file type.
 byte getFlags()
          This method returns the flags.
 int[] getMup()
          This method returns the mup.
 int getNumberOfRecords()
          This method returns the number of records.
 int getNumFields()
          This method returns the number of fields.
 int getNumRecords()
          This method returns the number of records.
 short getPositionOfFirstDataRecorded()
          This method returns the position of the first data record.
 DBFRecord getRecord(int index)
          This method returns the record at a given index.
 short getReserved()
          This method returns the reserved data.
 byte getTerminator()
          This method returns the terminator.
 short getZeroes()
          This method returns the zeros.
 java.util.Iterator<DBFRecord> recordsIterator()
          This method returns an iterator for all the record data.
 void setCodePageMark(byte initCodePageMark)
          This method sets the code page mark to the new input value.
 void setDataRecordLength(short initDataRecordLength)
          This method sets the data record length to the new input value.
 void setDbaseEncryptionFlag(byte initDbaseEncryptionFlag)
          This method sets the database encryption flag to the new input value.
 void setDbaseTransactionFlag(byte initDbaseTransactionFlag)
          This method sets the database transaction flag to the new input value.
 void setFileType(byte initFileType)
          This method sets the file type to the new input value.
 void setFlags(byte initFlags)
          This method sets the flags to the new input value.
 void setLastModifiedDate(int year, int month, int day)
          This method sets the last modified date.
 void setMup(int[] initMup)
          This method sets the mups to the new input value.
 void setNumberOfRecords(int initNumberOfRecords)
          This method sets the number of records to the new input value.
 void setPositionOfFirstDataRecorded(short initPositionOfFirstDataRecorded)
          This method sets the position of the first data record to the new input value.
 void setReserved(short initReserved)
          This method sets the reserved to the new input value.
 void setTerminator(byte initTerminator)
          This method sets the terminator to the new input value.
 void setZeroes(short initZeroes)
          This method sets the zeroes to the new input value.
 void sortRecords(java.lang.String fieldName, boolean increasing)
          This method sorts the records in this table according to the provided field name and in increasing order if the increasing argument is true, in decreasing order otherwise.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBFTable

public DBFTable()
This default constructor simply sets up the fields and records vectors.

Method Detail

getFileType

public byte getFileType()
This method returns the file type.

Returns:
The file type.

getNumberOfRecords

public int getNumberOfRecords()
This method returns the number of records.

Returns:
The number of records.

getPositionOfFirstDataRecorded

public short getPositionOfFirstDataRecorded()
This method returns the position of the first data record.

Returns:
The first position of the data record.

getDataRecordLength

public short getDataRecordLength()
This method returns the data record length.

Returns:
The data record length.

getZeroes

public short getZeroes()
This method returns the zeros.

Returns:
The zeroes.

getDbaseTransactionFlag

public byte getDbaseTransactionFlag()
This method returns the database transaction flag.

Returns:
The database transaction flag.

getDbaseEncryptionFlag

public byte getDbaseEncryptionFlag()
This method returns the database encryption flag.

Returns:
The database encryption flag.

getMup

public int[] getMup()
This method returns the mup.

Returns:
The mup value.

getFlags

public byte getFlags()
This method returns the flags.

Returns:
The flags.

getCodePageMark

public byte getCodePageMark()
This method returns the code page mark.

Returns:
The code page mark.

getReserved

public short getReserved()
This method returns the reserved data.

Returns:
The reserved data.

getTerminator

public byte getTerminator()
This method returns the terminator.

Returns:
The terminator.

getField

public DBFField getField(int index)
This method returns the field at a given index.

Parameters:
index - The location of the data.
Returns:
The data at the specified location.

getRecord

public DBFRecord getRecord(int index)
This method returns the record at a given index.

Parameters:
index - The location of the data.
Returns:
The data at the specified location.

getNumFields

public int getNumFields()
This method returns the number of fields.

Returns:
Number of fields.

getNumRecords

public int getNumRecords()
This method returns the number of records.

Returns:
Number of records.

fieldsIterator

public java.util.Iterator<DBFField> fieldsIterator()
This method returns an iterator for all the field data.

Returns:
All the field data.

recordsIterator

public java.util.Iterator<DBFRecord> recordsIterator()
This method returns an iterator for all the record data.

Returns:
All the record data.

setFileType

public void setFileType(byte initFileType)
This method sets the file type to the new input value.

Parameters:
initFileType - The new file type.

setNumberOfRecords

public void setNumberOfRecords(int initNumberOfRecords)
This method sets the number of records to the new input value.

Parameters:
initNumberOfRecords - The new number of records value.

setPositionOfFirstDataRecorded

public void setPositionOfFirstDataRecorded(short initPositionOfFirstDataRecorded)
This method sets the position of the first data record to the new input value.

Parameters:
initPositionOfFirstDataRecorded - The new position of the first data record length.

setDataRecordLength

public void setDataRecordLength(short initDataRecordLength)
This method sets the data record length to the new input value.

Parameters:
initDataRecordLength - The new data record length.

setZeroes

public void setZeroes(short initZeroes)
This method sets the zeroes to the new input value.

Parameters:
initZeroes - The new zeroes value.

setDbaseTransactionFlag

public void setDbaseTransactionFlag(byte initDbaseTransactionFlag)
This method sets the database transaction flag to the new input value.

Parameters:
initDbaseTransactionFlag - The new database transaction flag value.

setDbaseEncryptionFlag

public void setDbaseEncryptionFlag(byte initDbaseEncryptionFlag)
This method sets the database encryption flag to the new input value.

Parameters:
initDbaseEncryptionFlag - The new database encryption flag value.

setMup

public void setMup(int[] initMup)
This method sets the mups to the new input value.

Parameters:
initMup - The new mup value.

setFlags

public void setFlags(byte initFlags)
This method sets the flags to the new input value.

Parameters:
initFlags - The new flags value.

setCodePageMark

public void setCodePageMark(byte initCodePageMark)
This method sets the code page mark to the new input value.

Parameters:
initCodePageMark - The new code page mark value.

setReserved

public void setReserved(short initReserved)
This method sets the reserved to the new input value.

Parameters:
initReserved - The new reserved data.

setTerminator

public void setTerminator(byte initTerminator)
This method sets the terminator to the new input value.

Parameters:
initTerminator - The new terminator value.

setLastModifiedDate

public void setLastModifiedDate(int year,
                                int month,
                                int day)
This method sets the last modified date.

Parameters:
year - The year.
month - The month.
day - The day.

addField

public void addField(DBFField dbf)
This method adds a Field.

Parameters:
dbf - The DBFField to add.

addRecord

public void addRecord(DBFRecord dbr)
This method adds a record.

Parameters:
dbr - The DBFRecord to add.

sortRecords

public void sortRecords(java.lang.String fieldName,
                        boolean increasing)
This method sorts the records in this table according to the provided field name and in increasing order if the increasing argument is true, in decreasing order otherwise.

Parameters:
fieldName - The name of the field.
increasing - Whether or not to sort by increasing values.