public class IndexedDbaseFileReader extends DbaseFileReader
FileChannel in = new FileInputStream("thefile.dbf").getChannel();
DbaseFileReader r = new DbaseFileReader( in )
Object[] fields = new Object[r.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).
FileChannel in = new FileInputStream("thefile.dbf").getChannel();
DbaseFileReader r = new 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();
DbaseFileReader.Row
currentOffset, randomAccessEnabled, useMemoryMappedBuffer
Constructor and Description |
---|
IndexedDbaseFileReader(ShpFiles shpFiles)
Like calling DbaseFileReader(ReadableByteChannel, true);
|
IndexedDbaseFileReader(ShpFiles shpFiles,
boolean useMemoryMappedBuffer)
Creates a new instance of DBaseFileReader
|
IndexedDbaseFileReader(ShpFiles shpFiles,
boolean useMemoryMappedBuffer,
Charset stringCharset) |
IndexedDbaseFileReader(ShpFiles shpFiles,
boolean useMemoryMappedBuffer,
Charset stringCharset,
TimeZone timeZone) |
Modifier and Type | Method and Description |
---|---|
void |
goTo(int recno) |
boolean |
IsRandomAccessEnabled() |
static void |
main(String[] args) |
public IndexedDbaseFileReader(ShpFiles shpFiles) throws IOException
IOException
public IndexedDbaseFileReader(ShpFiles shpFiles, boolean useMemoryMappedBuffer) throws IOException
useMemoryMappedBuffer
- Wether or not map the file in memoryIOException
- If an error occurs while initializing.public IndexedDbaseFileReader(ShpFiles shpFiles, boolean useMemoryMappedBuffer, Charset stringCharset) throws IOException
IOException
public IndexedDbaseFileReader(ShpFiles shpFiles, boolean useMemoryMappedBuffer, Charset stringCharset, TimeZone timeZone) throws IOException
IOException
public void goTo(int recno) throws IOException, UnsupportedOperationException
public boolean IsRandomAccessEnabled()
Copyright © 1996–2023 Geotools. All rights reserved.