public class DbfFile extends DbfTableModel
Modifier and Type | Field and Description |
---|---|
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 |
_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
DBF_ATTRIBUTE, DBF_AUTOINCREMENT, DBF_BINARY, DBF_CHARACTER, DBF_DATE, DBF_DOUBLE, DBF_FLOAT, DBF_LOGICAL, DBF_LONG, DBF_MEMO, DBF_NUMERIC, DBF_OLE, DBF_TIMESTAMP, DBF_TYPE_AUTOINCREMENT, DBF_TYPE_BINARY, DBF_TYPE_CHARACTER, DBF_TYPE_DATE, DBF_TYPE_DOUBLE, DBF_TYPE_FLOAT, DBF_TYPE_LOGICAL, DBF_TYPE_LONG, DBF_TYPE_MEMO, DBF_TYPE_NUMERIC, DBF_TYPE_OLE, DBF_TYPE_TIMESTAMP, PARAM_DBF, PARAM_SHP, PARAM_SHX, SHAPE_BOUNDS_ATTRIBUTE, SHAPE_DBF_DASHPATTERN, SHAPE_DBF_DASHPHASE, SHAPE_DBF_DESCRIPTION, SHAPE_DBF_FILLCOLOR, SHAPE_DBF_INFO_ATTRIBUTE, SHAPE_DBF_LINECOLOR, SHAPE_DBF_LINEWIDTH, SHAPE_DBF_SELECTCOLOR, SHAPE_FILE_HEADER_LENGTH, SHAPE_FILE_RECORD_HEADER_LENGTH, SHAPE_INDEX_ATTRIBUTE, SHAPE_MAX_MEASURE_ATTRIBUTE, SHAPE_MAX_Z_ATTRIBUTE, SHAPE_MEASURE_ATTRIBUTE, SHAPE_MIN_MEASURE_ATTRIBUTE, SHAPE_MIN_Z_ATTRIBUTE, SHAPE_TYPE_ARC, SHAPE_TYPE_MULTIPATCH, SHAPE_TYPE_MULTIPOINT, SHAPE_TYPE_MULTIPOINTM, SHAPE_TYPE_MULTIPOINTZ, SHAPE_TYPE_NULL, SHAPE_TYPE_POINT, SHAPE_TYPE_POINTM, SHAPE_TYPE_POINTZ, SHAPE_TYPE_POLYGON, SHAPE_TYPE_POLYGONM, SHAPE_TYPE_POLYGONZ, SHAPE_TYPE_POLYLINE, SHAPE_TYPE_POLYLINEM, SHAPE_TYPE_POLYLINEZ, SHAPE_Z_ATTRIBUTE
Modifier | Constructor and Description |
---|---|
protected |
DbfFile() |
|
DbfFile(BinaryFile bf) |
|
DbfFile(int columnCount)
Creates a blank DbfTableModel
|
Modifier and Type | Method and Description |
---|---|
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) |
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, matches, read, remove, remove, remove, remove, setColumnName, setDecimalCount, setExitOnClose, setLength, setType, setValueAt, setWritable, showGUI, tableChanged, test, write
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
protected int _rowCount
protected int _recordLength
protected int _headerLength
protected java.lang.Object[] _columnMask
protected java.text.DecimalFormat df
protected BinaryFile bf
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
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)
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details