|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.layer.vpf.DcwRecordFile
public class DcwRecordFile
Read and encapsulate VPF table files.
Field Summary | |
---|---|
protected boolean |
byteorder
remember the byte order for later file openings, true for MSB first |
protected DcwColumnInfo[] |
columnInfo
ordered set of columns (read from table header) |
protected java.lang.String |
documentationFileName
the name of another table that describes what this one is for |
protected java.lang.String |
filename
the name of the file |
static java.lang.String |
ID_COLUMN_NAME
the name of the row identifier column "id" |
protected BinaryFile |
inputFile
input is read from this file |
protected boolean |
MSBFirst
big-endian ( true ) or little-endian (
false ) |
protected int |
recordLength
length of a record ( -1 indicates
variable-length record) |
protected java.lang.String |
tableDescription
the description of the table [read from the file] |
protected java.lang.String |
tablename
the name of the table |
protected DcwVariableLengthIndexFile |
vli
for tables with variable-length records, the corresponding variable-length index |
Constructor Summary | |
---|---|
DcwRecordFile(java.lang.String name)
Open a DcwRecordFile and completely initialize it |
|
DcwRecordFile(java.lang.String name,
boolean deferInit)
Open a DcwRecordFile |
Method Summary | |
---|---|
void |
close()
Closes the associated input file. |
protected void |
finalize()
releases associated resources |
void |
finishInitialization()
Complete initialization of this object. |
int |
getColumnCount()
Returns the number of columns this table has |
DcwColumnInfo[] |
getColumnInfo()
Return the column info for this table. |
java.lang.String |
getColumnName(int index)
Returns the name of a column |
java.lang.String |
getDescription()
Returns the table description for this table. |
java.lang.String |
getDocumentationFilename()
Returns the documentation file associated with this table. |
int |
getRecordCount()
Gets the number of records in the table. |
int |
getRecordLength()
get the length of a single record |
java.util.List<java.lang.Object> |
getRow(int rownumber)
Parses the row specified by rownumber |
boolean |
getRow(java.util.List<java.lang.Object> retval,
int rownumber)
Parses the row specified by rownumber |
java.lang.String |
getTableFile()
Returns the File this instance is using |
java.lang.String |
getTableName()
return the name of the table |
TilingAdapter |
getTilingAdapter(int tileColumn,
int primColumn)
Returns a TilingAdapter for the selected column. |
TilingAdapter |
getTilingAdapter(java.lang.String primColumnName)
Returns a TilingAdapter for the selected column. |
TilingAdapter |
getTilingAdapter(java.lang.String tileColumnName,
java.lang.String primColumnName)
Returns a TilingAdapter for the selected column. |
int[] |
lookupSchema(java.lang.String[] names,
boolean mustExist)
Get the column number for a set of column names. |
int[] |
lookupSchema(java.lang.String[] names,
boolean mustExist,
char[] type,
int[] length,
boolean strictlength)
Get the column number for a set of column names. |
static void |
main(java.lang.String[] args)
An test main for parsing VPF table files. |
void |
parseAllRowsAndPrintSome()
Good for looking at the contents of a data file, this method dumps a bunch of rows to System.out. |
java.util.List<java.lang.Object> |
parseRow()
Return a row from the table. |
boolean |
parseRow(java.util.List<java.lang.Object> retval)
Return a row from the table. |
void |
parseSomeRowsAndPrint()
Good for looking at the contents of a data file, this method dumps a bunch of rows to System.out. |
void |
printSchema()
Prints the table information to System.out. |
void |
reopen(int seekRow)
Reopen the associated input file. |
void |
seekToRow(int recordNumber)
moves the input cursor to the specified row [affects subsequent calls parseRow.] |
int |
whatColumn(java.lang.String columnname)
Returns the index into columnInfo of the column with the specified name |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected BinaryFile inputFile
protected java.lang.String tableDescription
protected java.lang.String documentationFileName
protected boolean MSBFirst
true
) or little-endian (
false
)
protected DcwColumnInfo[] columnInfo
protected int recordLength
-1
indicates
variable-length record)
protected DcwVariableLengthIndexFile vli
protected final java.lang.String filename
protected java.lang.String tablename
protected boolean byteorder
public static final java.lang.String ID_COLUMN_NAME
Constructor Detail |
---|
public DcwRecordFile(java.lang.String name) throws FormatException
name
- the name of the file to use for input
FormatException
- some problem was encountered dealing
with the filepublic DcwRecordFile(java.lang.String name, boolean deferInit) throws FormatException
name
- the name of the file to use for inputdeferInit
- if true
, don't actually open
files and initialize the object. In this state, the only
method that should be called is finishInitialization.
FormatException
- some problem was encountered dealing
with the filefinishInitialization()
Method Detail |
---|
public java.lang.String getTableFile()
public java.lang.String getTableName()
public void finishInitialization() throws FormatException
FormatException
- some problem was encountered dealing
with the filepublic TilingAdapter getTilingAdapter(java.lang.String primColumnName)
primColumnName
- the name of the primitive column
public TilingAdapter getTilingAdapter(java.lang.String tileColumnName, java.lang.String primColumnName)
primColumnName
- the name of the primitive columntileColumnName
- the name of the tile_id column
public TilingAdapter getTilingAdapter(int tileColumn, int primColumn)
primColumn
- the position of the primitive columntileColumn
- the position of the tile_id column
public int[] lookupSchema(java.lang.String[] names, boolean mustExist) throws FormatException
names
- the names of the columns
FormatException
- the table does not match the
specified schemapublic int[] lookupSchema(java.lang.String[] names, boolean mustExist, char[] type, int[] length, boolean strictlength) throws FormatException
names
- the names of the columnstype
- in same order as nameslength
- in same order as names (-1 for a variable length
column)strictlength
- false means that variable length columns
can be fixed-length insteadmustExist
- if true and a column doesn't exist, method
returns null
FormatException
- the table does not match the
specified schemapublic void parseAllRowsAndPrintSome() throws FormatException
FormatException
- some kind of data format error was
encountered while parsing the filepublic void parseSomeRowsAndPrint() throws FormatException
FormatException
- some kind of data format error was
encountered while parsing the filepublic java.util.List<java.lang.Object> parseRow() throws FormatException
FormatException
- an error was encountered reading the
rowpublic boolean parseRow(java.util.List<java.lang.Object> retval) throws FormatException
retval
- append the fields from a row in the table.
clear() is called before any real work is done.
FormatException
- an error was encountered reading the
rowList.clear()
public java.lang.String getDocumentationFilename()
public java.lang.String getDescription()
public int getRecordLength()
public int getRecordCount() throws FormatException
FormatException
- some problem was encountered dealing
with the filepublic java.util.List<java.lang.Object> getRow(int rownumber) throws FormatException
rownumber
- the number of the row to return
[1..recordCount]
FormatException
- data format errorspublic boolean getRow(java.util.List<java.lang.Object> retval, int rownumber) throws FormatException
rownumber
- the number of the row to return
[1..recordCount]retval
- values contained in the row
FormatException
- data format errorsparseRow()
public void seekToRow(int recordNumber) throws FormatException
recordNumber
- the number of the row to seek to
FormatException
- data format errors
java.lang.IllegalArgumentException
- recordNumber less than 1public int whatColumn(java.lang.String columnname)
columnname
- the column name to match
public java.lang.String getColumnName(int index)
index
- the column to get the name for
public void printSchema() throws FormatException
FormatException
- some problem was encountered dealing
with the filepublic void close()
public void reopen(int seekRow) throws FormatException
seekRow
- the row to seek to upon reopening the file. If
seekRow is invalid (less than 1), then the input stream
is in an undefined location, and seekToRow (or
getRow(int)) must be called before parseRow
FormatException
- some error was encountered in
reopening file or seeking to the desired row.parseRow()
,
getRow(int)
,
close()
public final int getColumnCount()
public final DcwColumnInfo[] getColumnInfo()
NOTE: modifying this array is likely to cause problems...
protected void finalize()
finalize
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- file names to be read
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |