|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.fhg.igd.earth.model.input.shapefile.ShapeUtils
de.fhg.igd.earth.model.input.shapefile.DBaseFile
Class representing a DBase File. Title : Earth Copyright : Copyright (c) 2001 Organisation : IGD FhG
| Field Summary | |
static int |
DEFAULT_RECORD_BUFFER_SIZE_DB
A default DBase record size. |
protected int[] |
fieldLength
A field that holds the length of the DBase fields, in bytes. |
protected String[] |
fieldName
A field that holds the names of the DBase fields, as a string. |
protected char[] |
fieldType
A field that holds the types of the DBase fields, as a char. |
protected long |
fileLength
Holds the length of the DBase file, in bytes. |
protected byte[] |
header
The buffer that holds header of the DBase file. |
protected int |
headerLength
Holds the length of the DBase file header. |
protected boolean |
io
A flag for the IO mode true=read/write false=read. |
protected RandomAccessFile |
raf
The read/write class for shape DBase files. |
protected byte[] |
recBuf
A buffer for the current DBase record's data. |
protected int |
recordLength
Holds the record length of the DBase file, as an int. |
protected int |
recordNumbers
Holds the numbers of the records, in bytes. |
protected int |
rows
Holds the numbers of the row of the DBase file, as an int. |
| Fields inherited from class de.fhg.igd.earth.model.input.shapefile.ShapeUtils |
SHAPE_FILE_HEADER_LENGTH, SHAPE_FILE_HEADER_LENGTH_DB, SHAPE_FILE_RECORD_HEADER_LENGTH, SHAPE_TYPE_ARC, SHAPE_TYPE_MULTIPOINT, SHAPE_TYPE_NULL, SHAPE_TYPE_POINT, SHAPE_TYPE_POLYGON, SHAPE_TYPE_POLYLINE |
| Constructor Summary | |
DBaseFile(String name)
Construct a DBaseFile from a file name. |
|
| Method Summary | |
void |
addRecord(DBaseFile dbf)
Adds a record to the end of this file. |
void |
close()
Closes the DBase file and disposes of resources. |
String |
getFieldData(int index)
Returns the field data of the table at the current position |
String |
getFieldName(int index)
Returns the field name of the DBase table |
char |
getFieldType(int index)
Returns the field type of the table |
int |
getNextRecord()
Reads the next record from the DBase file Each successive call gets the next record. |
protected void |
initHeader()
Reads or initialises the header of a DBase file. |
int |
numRows()
Returns the number of rows of the DBase table |
protected void |
readHeader()
Reads and parses the header of the file. |
void |
writeHeader(DBaseFile dbf)
Writes a header into an empty DBase file A prototype header of another DBase file is needed |
| Methods inherited from class de.fhg.igd.earth.model.input.shapefile.ShapeUtils |
readBEInt, readBox, readLEDouble, readLEInt, readLEInt, readLELong, readPoint, writeBEInt, writeBox, writeLEDouble, writeLEInt, writeLELong, writePoint |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DEFAULT_RECORD_BUFFER_SIZE_DB
protected RandomAccessFile raf
protected byte[] header
protected int headerLength
protected long fileLength
protected int recordNumbers
protected int rows
protected int recordLength
protected byte[] recBuf
protected boolean io
protected String[] fieldName
protected int[] fieldLength
protected char[] fieldType
| Constructor Detail |
public DBaseFile(String name)
throws IOException
DBaseFile from a file name.
IOException - if something goes wrong opening or
reading the file.| Method Detail |
protected void initHeader()
throws IOException
After this function runs, the file pointer is set to the first byte of the first record in the file.
IOException - if something goes wrong reading or writing
the DBase file
public void writeHeader(DBaseFile dbf)
throws IOException
IOException - if something goes wrong reading the file
protected void readHeader()
throws IOException
IOException - if something goes wrong reading the filepublic int numRows()
public String getFieldName(int index)
IOException - if something goes wrong reading the filepublic String getFieldData(int index)
IOException - if something goes wrong reading the filepublic char getFieldType(int index)
IOException - if something goes wrong reading the file
public int getNextRecord()
throws IOException
null is returned.
IOException - if something goes wrong reading the file
public void addRecord(DBaseFile dbf)
throws IOException
IOException - if something goes wrong writing to the file
public void close()
throws IOException
IOException - if something goes wrong closing the file
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||