deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.io.dbaseapi
Class DBaseFile

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

public class DBaseFile
extends 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: 19488 $, $Date: 2009-09-03 15:05:04 +0200 (Do, 03. Sep 2009) $
Author:
Andreas Poth, last edited by: $Author: aschmitz $

Constructor Summary
DBaseFile(String url)
          constructor
only for reading a dBase file
DBaseFile(String url, FieldDescriptor[] fieldDesc)
          constructor
only for writing a dBase file
 
Method Summary
 void close()
           
 String getColumn(String col_name)
           
 int getDataLength(String field)
           
 String[] getDataTypes()
           
 String[] getDataTypes(String[] fields)
           
 FeatureType getFeatureType()
           
 Feature getFRow(int rowNo)
          Returns a row of the dBase file as a Feature instance.
 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, Map<PropertyType,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(ArrayList recData)
          writes a data record to byte array representing the data section of the dBase file.
 void setRecord(int index, ArrayList 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(String url)
          throws IOException
constructor
only for reading a dBase file

Parameters:
url -
Throws:
IOException

DBaseFile

public DBaseFile(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,
                           Map<PropertyType,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 String getColumn(String col_name)
                 throws DBaseException
Parameters:
col_name -
Returns:
column's string value from the current row.
Throws:
DBaseException

getProperties

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

getDataTypes

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

getDataLength

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

getDataTypes

public String[] getDataTypes(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 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:
IOException
DBaseException

setRecord

public void setRecord(ArrayList 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,
                      ArrayList 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.3 (2010/04/09 10:10 build-4-official)

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