|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel com.bbn.openmap.dataAccess.shape.DbfTableModel com.bbn.openmap.dataAccess.shape.DbfFile
public class DbfFile
An extension to DbfTableModel that handles reading only certain records when needed, in conjunction with some spatial indexing mechanism. Can be told to which columns to read and which to skip, so unnecessary/unused information isn't held in memory.
Field Summary | |
---|---|
protected java.lang.Object[] |
_columnMask
This _columnMask variable is an array that either contains a Boolean.TRUE for the indexes for columns that should be read, or a Integer object that contains the byte length of the column entry, so the reader will know how many bytes to skip for columns being ignored. |
protected int |
_headerLength
|
protected int |
_recordLength
|
protected int |
_rowCount
|
protected BinaryFile |
bf
|
protected java.text.DecimalFormat |
df
|
Fields inherited from class com.bbn.openmap.dataAccess.shape.DbfTableModel |
---|
_columnCount, _decimalCounts, _lengths, _names, _records, _types, DEBUG, dirty, DONE_MASK, exitOnClose, filePath, frame, logger, MODIFY_COLUMN_MASK, MODIFY_ROW_MASK, parent, SAVE_MASK, table, TYPE_AUTOINCREMENT, TYPE_BINARY, TYPE_CHARACTER, TYPE_DATE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_LOGICAL, TYPE_LONG, TYPE_MEMO, TYPE_NUMERIC, TYPE_OLE, TYPE_TIMESTAMP, writable, ZERO |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
protected |
DbfFile()
|
|
DbfFile(BinaryFile bf)
|
|
DbfFile(int columnCount)
Creates a blank DbfTableModel |
Method Summary | |
---|---|
void |
clearRecords()
Clear the record information from memory. |
void |
close()
Tells the BinaryFile input reader to close, releasing the file pointer. |
protected void |
createColumnMaskArray(boolean[] mask)
Given a boolean[] where trues mark columns to keep, a _columnMask Object[] is set on this object with Boolean.TRUE objects in that array for the trues, and Integer objects representing the lengths of the false columns. |
BinaryFile |
getBinaryFile()
|
boolean[] |
getColumnMask()
Checks the _columnMask Object[] and looks for Boolean.TRUE objects, indicating a column that should be used. |
static DbfTableModel |
getDbfTableModel(java.lang.String dbf)
Creates a DbfTableModel for a given .dbf file |
static DbfTableModel |
getDbfTableModel(java.net.URL dbf)
Creates a DbfTableModel for a given .dbf file |
java.text.DecimalFormat |
getDecimalFormat()
|
int |
getHeaderLength()
|
java.util.List<java.lang.Object> |
getRecordData(int index)
Fetches the record data for the given index. |
int |
getRecordLength()
|
int |
getRowCount()
Retrieves the number of columns that exist in the model |
DbfTableModel |
headerClone()
Create another DbfTableModel with the same structure as this one (number of columns, column names, lengths and decimal counts). |
static void |
main(java.lang.String[] args)
|
void |
readData()
Reads the data and puts data in an ArrayList of records. |
void |
readData(int startingRecordIndex,
int numRecordsToRead)
Read in a set of records from the dbf file, starting at the provided index and continuing for the provided count. |
void |
readHeader(BinaryFile bf)
|
protected void |
resolveColumns()
Sets the metadata for the dbf file to match the current _columnMask settings. |
void |
setBinaryFile(BinaryFile bf)
|
void |
setColumnMask(boolean[] mask)
Limit which columns are read from the dbf file using a boolean array corresponding to the columns. |
void |
setColumnMask(java.lang.String[] columnNames)
Limit which columns are read from the dbf file using the column names. |
void |
setDecimalFormat(java.text.DecimalFormat df)
|
void |
setHeaderLength(int length)
|
void |
setRecordLength(int length)
|
void |
setRowCount(int count)
|
Methods inherited from class com.bbn.openmap.dataAccess.shape.DbfTableModel |
---|
add, add, add, addBlankRecord, addColumn, addRecord, append, appendWhitespaceOrTrim, cleanupChanges, commitEvents, deleteColumn, doAction, exitWindowClosed, getBlankRecord, getColumnClass, getColumnCount, getColumnIndexForName, getColumnName, getDecimalCount, getEmptyDefaultForType, getGUI, getLength, getObjectForType, getRecord, getRecords, getStringForType, getTable, getTable, getType, getValueAt, getWritable, hideGUI, isCellEditable, isExitOnClose, isNumericalType, isValidType, iterator, matches, read, remove, remove, remove, remove, setColumnName, setDecimalCount, setExitOnClose, setLength, setType, setValueAt, setWritable, showGUI, tableChanged, test, write |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int _rowCount
protected int _recordLength
protected int _headerLength
protected java.lang.Object[] _columnMask
protected java.text.DecimalFormat df
protected BinaryFile bf
Constructor Detail |
---|
protected DbfFile()
public DbfFile(int columnCount)
columnCount
- The number of columns this model will managepublic DbfFile(BinaryFile bf) throws java.io.EOFException, FormatException, java.io.IOException
java.io.EOFException
FormatException
java.io.IOException
Method Detail |
---|
public void readHeader(BinaryFile bf) throws FormatException, java.io.IOException
FormatException
java.io.IOException
public void close()
public void readData() throws java.io.IOException, FormatException
java.io.IOException
FormatException
public void readData(int startingRecordIndex, int numRecordsToRead) throws java.io.IOException, FormatException
startingRecordIndex
- , 0 is the first record index.numRecordsToRead
-
java.io.IOException
FormatException
public java.util.List<java.lang.Object> getRecordData(int index) throws java.io.IOException, FormatException
index
- the index of the data, starting at 0 for the first record.
java.io.IOException
FormatException
public void clearRecords()
public DbfTableModel headerClone()
headerClone
in class DbfTableModel
public static DbfTableModel getDbfTableModel(java.net.URL dbf)
dbf
- The url of the file to retrieve.
public static DbfTableModel getDbfTableModel(java.lang.String dbf)
dbf
- The path of the file to retrieve.
public static void main(java.lang.String[] args)
public boolean[] getColumnMask()
protected void createColumnMaskArray(boolean[] mask)
mask
- public void setColumnMask(boolean[] mask)
mask
- public void setColumnMask(java.lang.String[] columnNames)
columnNames
- protected void resolveColumns()
public int getHeaderLength()
public void setHeaderLength(int length)
public int getRecordLength()
public void setRecordLength(int length)
public int getRowCount()
DbfTableModel
getRowCount
in interface javax.swing.table.TableModel
getRowCount
in class DbfTableModel
public void setRowCount(int count)
public BinaryFile getBinaryFile()
public void setBinaryFile(BinaryFile bf) throws java.io.EOFException, FormatException, java.io.IOException
java.io.EOFException
FormatException
java.io.IOException
public java.text.DecimalFormat getDecimalFormat()
public void setDecimalFormat(java.text.DecimalFormat df)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |