deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.io.dbaseapi
Class DBaseFile

java.lang.Object
  extended by org.deegree.io.dbaseapi.DBaseFile

public class DBaseFile
extends java.lang.Object

the datatypes of the dBase file and their representation as java types: dBase-type dBase-type-ID java-type character "C" String float "F" Float number "N" Double logical "L" String memo "M" String date "D" Date binary "B" ByteArrayOutputStream

Version:
$Revision: 24227 $, $Date: 2010-05-07 11:57:54 +0200 (Fr, 07 Mai 2010) $
Author:
Andreas Poth, last edited by: $Author: apoth $

Constructor Summary
DBaseFile(java.lang.String url)
          constructor
only for reading a dBase file
DBaseFile(java.lang.String url, FieldDescriptor[] fieldDesc)
          constructor
only for writing a dBase file
 
Method Summary
 void close()
           
 java.lang.String getColumn(java.lang.String col_name)
           
 int getDataLength(java.lang.String field)
           
 java.lang.String[] getDataTypes()
           
 java.lang.String[] getDataTypes(java.lang.String[] fields)
           
 FeatureType getFeatureType()
           
 Feature getFRow(int rowNo)
          Returns a row of the dBase file as a Feature instance.
 java.lang.String[] getProperties()
           
 int getRecordNum()
           
 void goTop()
          Positions the record pointer at the top of the table.
 boolean nextRecord()
          Advance the record pointer to the next record.
 void setFeatureType(FeatureType ft, java.util.Map<PropertyType,java.lang.String> ftMapping)
          Overrides the default feature type (which is generated from all columns in the dbase file) to allow customized naming and ordering of properties.
 void setRecord(int index, java.util.List<?> recData)
          writes a data record to byte array representing the data section of the dBase file.
 void setRecord(java.util.List<?> recData)
          writes a data record to byte array representing the data section of the dBase file.
 void writeAllToFile()
          creates the dbase file and writes all data to it if the file specified by fname (s.o.) exists it will be deleted!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBaseFile

public DBaseFile(java.lang.String url)
          throws java.io.IOException
constructor
only for reading a dBase file

Parameters:
url -
Throws:
java.io.IOException

DBaseFile

public DBaseFile(java.lang.String url,
                 FieldDescriptor[] fieldDesc)
          throws DBaseException
constructor
only for writing a dBase file

Parameters:
url -
fieldDesc -
Throws:
DBaseException
Method Detail

close

public void close()

setFeatureType

public void setFeatureType(FeatureType ft,
                           java.util.Map<PropertyType,java.lang.String> ftMapping)
Overrides the default feature type (which is generated from all columns in the dbase file) to allow customized naming and ordering of properties.

Parameters:
ft -
ftMapping -

getRecordNum

public int getRecordNum()
                 throws DBaseException
Returns:
number of records in the table
Throws:
DBaseException

goTop

public void goTop()
           throws DBaseException
Positions the record pointer at the top of the table.

Throws:
DBaseException

nextRecord

public boolean nextRecord()
                   throws DBaseException
Advance the record pointer to the next record.

Returns:
true if pointer has been increased
Throws:
DBaseException

getColumn

public java.lang.String getColumn(java.lang.String col_name)
                           throws DBaseException
Parameters:
col_name -
Returns:
column's string value from the current row.
Throws:
DBaseException

getProperties

public java.lang.String[] getProperties()
                                 throws DBaseException
Returns:
properties (column headers) of the dBase-file
Throws:
DBaseException

getDataTypes

public java.lang.String[] getDataTypes()
                                throws DBaseException
Returns:
datatype of each column of the database
Throws:
DBaseException

getDataLength

public int getDataLength(java.lang.String field)
                  throws DBaseException
Parameters:
field -
Returns:
the size of a column
Throws:
DBaseException

getDataTypes

public java.lang.String[] getDataTypes(java.lang.String[] fields)
                                throws DBaseException
Parameters:
fields -
Returns:
the datatype of each column of the database specified by fields
Throws:
DBaseException

getFRow

public Feature getFRow(int rowNo)
                throws DBaseException
Returns a row of the dBase file as a Feature instance.

Parameters:
rowNo -
Returns:
a row of the dBase file as a Feature instance
Throws:
DBaseException

writeAllToFile

public void writeAllToFile()
                    throws java.io.IOException,
                           DBaseException
creates the dbase file and writes all data to it if the file specified by fname (s.o.) exists it will be deleted!

Throws:
java.io.IOException
DBaseException

setRecord

public void setRecord(java.util.List<?> recData)
               throws DBaseException
writes a data record to byte array representing the data section of the dBase file. The method gets the data type of each field in recData from fieldDesc wich has been set at the constructor.

Parameters:
recData -
Throws:
DBaseException

setRecord

public void setRecord(int index,
                      java.util.List<?> recData)
               throws DBaseException
writes a data record to byte array representing the data section of the dBase file. The method gets the data type of each field in recData from fieldDesc wich has been set at the constructor. index specifies the location of the retrieved record in the datasection. if an invalid index is used an exception will be thrown

Parameters:
index -
recData -
Throws:
DBaseException

getFeatureType

public FeatureType getFeatureType()
Returns:
the feature type of the generated features

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org