public class DbaseFileWriter extends Object
DbaseFileHeader header = ...
WritableFileChannel out = new FileOutputStream("thefile.dbf").getChannel();
DbaseFileWriter w = new DbaseFileWriter(header,out);
while ( moreRecords ) {
w.write( getMyRecord() );
}
w.close();
You must supply the moreRecords
and getMyRecord()
logic...Modifier and Type | Class and Description |
---|---|
static class |
DbaseFileWriter.FieldFormatter
Utility for formatting Dbase fields.
|
Constructor and Description |
---|
DbaseFileWriter(DbaseFileHeader header,
WritableByteChannel out)
Create a DbaseFileWriter using the specified header and writing to the given channel.
|
DbaseFileWriter(DbaseFileHeader header,
WritableByteChannel out,
Charset charset)
Create a DbaseFileWriter using the specified header and writing to the given channel.
|
DbaseFileWriter(DbaseFileHeader header,
WritableByteChannel out,
Charset charset,
TimeZone timeZone)
Create a DbaseFileWriter using the specified header and writing to the given channel.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Release resources associated with this writer.
|
DbaseFileHeader |
getHeader() |
boolean |
getReportFieldSizeErrors() |
void |
setReportFieldSizeErrors(boolean reportFieldSizeErrors) |
void |
write(Object[] record)
Write a single dbase record.
|
public DbaseFileWriter(DbaseFileHeader header, WritableByteChannel out) throws IOException
header
- The DbaseFileHeader to write.out
- The Channel to write to.IOException
- If errors occur while initializing.public DbaseFileWriter(DbaseFileHeader header, WritableByteChannel out, Charset charset) throws IOException
header
- The DbaseFileHeader to write.out
- The Channel to write to.IOException
- If errors occur while initializing.public DbaseFileWriter(DbaseFileHeader header, WritableByteChannel out, Charset charset, TimeZone timeZone) throws IOException
header
- The DbaseFileHeader to write.out
- The Channel to write to.charset
- The charset the dbf is (will be) encoded inIOException
- If errors occur while initializing.public void write(Object[] record) throws IOException, DbaseFileException
record
- The entries to write.IOException
- If IO error occurs.DbaseFileException
- If the entry doesn't comply to the header.public void close() throws IOException
IOException
- If errors occur.public boolean getReportFieldSizeErrors()
public void setReportFieldSizeErrors(boolean reportFieldSizeErrors)
public DbaseFileHeader getHeader()
Copyright © 1996–2019 Geotools. All rights reserved.