DbaseFileReader class

A DbaseFileReader is used to read a dbase III format file.
The general use of this class is:

FileChannel in = FileInputStream("thefile.dbf").getChannel(); DbaseFileReader r = DbaseFileReader( in ) Object[] fields = new Objectr.getHeader().getNumFields(); while (r.hasNext()) { r.readEntry(fields); // do stuff } r.close();

For consumers who wish to be a bit more selective with their reading of rows, the Row object has been added. The semantics are the same as using the readEntry method, but remember that the Row object is always the same. The values are parsed as they are read, so it pays to copy them out (as each call to Row.read() will result in an expensive String parse).
EACH CALL TO readEntry OR readRow ADVANCES THE FILE!
An example of using the Row method of reading:

FileChannel in = FileInputStream("thefile.dbf").getChannel(); DbaseFileReader r = DbaseFileReader( in ) int fields = r.getHeader().getNumFields(); while (r.hasNext()) { DbaseFileReader.Row row = r.readRow(); for (int i = 0; i < fields; i++) { // do stuff Foo.bar( row.read(i) ); } } r.close();

@author Ian Schneider, Andrea Aaime

Constructors

DbaseFileReader(AFileReader afileReader, [Charset stringCharset, TimeZones timeZone])

Properties

afileReader AFileReader
read / write
buffer LByteBuffer
read / write
bytes List<int>
read / write
cnt int
read / write
currentOffset int
read / write
endian Endian
read / write
fieldLengths List<int>
read / write
fieldOffsets List<int>
read / write
fieldTypes List<int>
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
read / write
MILLISECS_PER_DAY int
final
oneBytePerChar bool
read / write
row Row
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
stringCharset Charset
read / write
timeZone TimeZones
read / write

Methods

bufferCheck() Future<void>
close() → void
Clean up all resources associated with this reader.Highly recomended. [...]
fastParse(List<int> bytes, int fieldOffset, int fieldLen) String
Performs a faster byte[] to String conversion under the assumption the content is represented with one byte per char
fill(LByteBuffer buffer, AFileReader channel) Future<int>
getHeader() DbaseFileHeader
Get the header from this file. The header is read upon instantiation. [...]
handleFloat(int fieldOffset, dynamic object, int fieldLen) → dynamic
hasNext() bool
Query the reader as to whether there is another record. [...]
id() String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
open() Future<void>
read() Future
Reads the next record into memory. You need to use this directly when reading only a subset of the fields using {@link #readField(int)}.
readEntry() Future<List>
Get the next record (entry). Will return a array of values. [...]
readEntryInto(List entry) Future<List>
Copy the next entry into the array. [...]
readEntryWithOffset(List entry, int offset) Future<List>
Copy the next record into the array starting at offset. [...]
readField(int fieldNum) Future
Reads a single field from the current record and returns it. Remember to call {@link #read()} before starting to read fields from the dbf, and call it every time you need to move to the next record. [...]
readObject(int fieldOffset, int fieldNum) Future
readRow() Future<Row>
skip() → void
Skip the next record. [...]
toString() String
A string representation of this object. [...]
inherited
transferTo(DbaseFileWriter writer) → void
Transfer, by bytes, the next record to the writer. */

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited