| java.lang.Object org.geotools.data.shapefile.dbf.DbaseFileHeader
DbaseFileHeader | public class DbaseFileHeader (Code) | | Class to represent the header of a Dbase III file.
Creation date: (5/15/2001 5:15:30 PM)
|
Inner Class :class DbaseField | |
Method Summary | |
public void | addColumn(String inFieldName, char inFieldType, int inFieldLength, int inDecimalCount) Add a column to this DbaseFileHeader. | public Class | getFieldClass(int i) Determine the most appropriate Java Class for representing the data in the
field.
All packages are java.lang unless otherwise specified.
C (Character) -> String
N (Numeric) -> Integer or Double (depends on field's decimal count)
F (Floating) -> Double
L (Logical) -> Boolean
D (Date) -> java.util.Date
Unknown -> String
Parameters: i - The index of the field, from 0 to getNumFields() - 1 . | public int | getFieldDecimalCount(int inIndex) Get the decimal count of this field.
Parameters: inIndex - The field index. | public int | getFieldLength(int inIndex) Returns the field length in bytes.
Parameters: inIndex - The field index. | public String | getFieldName(int inIndex) Get the field name.
Parameters: inIndex - The field index. | public char | getFieldType(int inIndex) Get the character class of the field.
Parameters: inIndex - The field index. | public int | getHeaderLength() | public int | getLargestFieldSize() Get the largest field size of this table. | public Date | getLastUpdateDate() Get the date this file was last updated. | public int | getNumFields() Return the number of fields in the records. | public int | getNumRecords() | public int | getRecordLength() Get the length of the records in bytes. | public void | readHeader(ReadableByteChannel channel) Read the header data from the DBF file.
Parameters: channel - A readable byte channel. | public int | removeColumn(String inFieldName) Remove a column from this DbaseFileHeader.
Parameters: inFieldName - The name of the field, will ignore case and trim. | public void | setNumRecords(int inNumRecords) | public String | toString() Get a simple representation of this header. | public void | writeHeader(WritableByteChannel out) Write the header data to the DBF file.
Parameters: out - A channel to write to. |
addColumn | public void addColumn(String inFieldName, char inFieldType, int inFieldLength, int inDecimalCount) throws DbaseFileException(Code) | | Add a column to this DbaseFileHeader.
The type is one of (C N L or D) character, number, logical(true/false), or date.
The Field length is the total length in bytes reserved for this column.
The decimal count only applies to numbers(N), and floating point values (F),
and refers to the number of characters to reserve after the decimal point.
Don't expect miracles from this...
Field Type MaxLength
---------- ---------
C 254
D 8
F 20
N 18
Parameters: inFieldName - The name of the new field, must be less than 10 characters or itgets truncated. Parameters: inFieldType - A character representing the dBase field, ( see above ).Case insensitive. Parameters: inFieldLength - The length of the field, in bytes ( see above ) Parameters: inDecimalCount - For numeric fields, the number of decimal places to track. throws: DbaseFileException - If the type is not recognized. |
getFieldClass | public Class getFieldClass(int i)(Code) | | Determine the most appropriate Java Class for representing the data in the
field.
All packages are java.lang unless otherwise specified.
C (Character) -> String
N (Numeric) -> Integer or Double (depends on field's decimal count)
F (Floating) -> Double
L (Logical) -> Boolean
D (Date) -> java.util.Date
Unknown -> String
Parameters: i - The index of the field, from 0 to getNumFields() - 1 . A Class which closely represents the dbase field type. |
getFieldDecimalCount | public int getFieldDecimalCount(int inIndex)(Code) | | Get the decimal count of this field.
Parameters: inIndex - The field index. The decimal count. |
getFieldLength | public int getFieldLength(int inIndex)(Code) | | Returns the field length in bytes.
Parameters: inIndex - The field index. The length in bytes. |
getFieldName | public String getFieldName(int inIndex)(Code) | | Get the field name.
Parameters: inIndex - The field index. The name of the field. |
getFieldType | public char getFieldType(int inIndex)(Code) | | Get the character class of the field.
Parameters: inIndex - The field index. The dbase character representing this field. |
getHeaderLength | public int getHeaderLength()(Code) | | Get the length of the header
The length of the header in bytes. |
getLargestFieldSize | public int getLargestFieldSize()(Code) | | Get the largest field size of this table.
The largt field size iiin bytes. |
getLastUpdateDate | public Date getLastUpdateDate()(Code) | | Get the date this file was last updated.
The Date last modified. |
getNumFields | public int getNumFields()(Code) | | Return the number of fields in the records.
The number of fields in this table. |
getNumRecords | public int getNumRecords()(Code) | | Return the number of records in the file
The number of records in this table. |
getRecordLength | public int getRecordLength()(Code) | | Get the length of the records in bytes.
The number of bytes per record. |
readHeader | public void readHeader(ReadableByteChannel channel) throws IOException(Code) | | Read the header data from the DBF file.
Parameters: channel - A readable byte channel. If you have an InputStream you need to use, you cancall java.nio.Channels.getChannel(InputStream in). throws: IOException - If errors occur while reading. |
removeColumn | public int removeColumn(String inFieldName)(Code) | | Remove a column from this DbaseFileHeader.
Parameters: inFieldName - The name of the field, will ignore case and trim. index of the removed column, -1 if no found |
setNumRecords | public void setNumRecords(int inNumRecords)(Code) | | Set the number of records in the file
Parameters: inNumRecords - The number of records. |
toString | public String toString()(Code) | | Get a simple representation of this header.
A String representing the state of the header. |
writeHeader | public void writeHeader(WritableByteChannel out) throws IOException(Code) | | Write the header data to the DBF file.
Parameters: out - A channel to write to. If you have an OutputStream you can obtain the correctchannel by using java.nio.Channels.newChannel(OutputStream out). throws: IOException - If errors occur. |
|
|