com.svcon.jdbf
Class DBFReader

java.lang.Object
  |
  +--com.svcon.jdbf.DBFReader

public class DBFReader
extends java.lang.Object

Used to read database (DBF) files.

Create a DBFReader object passing a file name to be opened, and use hasNextRecord and nextRecord functions to iterate through the records of the file. The getFieldCount and getField methods allow you to find out what are the fields of the database file.


Constructor Summary
DBFReader(java.io.InputStream is)
          Opens a stream, containing DBF for reading.
DBFReader(java.lang.String fileName)
          Opens a DBF file for reading.
 
Method Summary
 void close()
          Closes the reader.
 JDBField getField(int index)
          Returns a field at a specified position.
 int getFieldCount()
          Returns the field count of the database file.
 boolean hasNextRecord()
          Checks to see if there are more records in the file.
 java.lang.Object[] nextRecord()
          Returns an array of objects, representing one record in the database file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBFReader

public DBFReader(java.lang.String fileName)
          throws JDBFException
Opens a DBF file for reading.
Parameters:
fileName - the name of the file.
Throws:
JDBFException - if an error occurred opening the file for reading.

DBFReader

public DBFReader(java.io.InputStream is)
          throws JDBFException
Opens a stream, containing DBF for reading.
Parameters:
is - the InputStream
Throws:
JDBFException - if an error occurred opening the stream.
Method Detail

getFieldCount

public int getFieldCount()
Returns the field count of the database file.
Returns:
the field count.

getField

public JDBField getField(int index)
Returns a field at a specified position.
Parameters:
index - the position.
Returns:
the field at that position.

hasNextRecord

public boolean hasNextRecord()
Checks to see if there are more records in the file.
Returns:
true if there are records; false if the end of file is reached.

nextRecord

public java.lang.Object[] nextRecord()
                              throws JDBFException
Returns an array of objects, representing one record in the database file.
Returns:
database record.
Throws:
JDBFException - if there are no more records or if an error occurred reading the file.

close

public void close()
           throws JDBFException
Closes the reader.
Throws:
JDBFException - if an error occurs while closing.