public class DbaseFileWriter
extends java.lang.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,
java.nio.channels.FileChannel out,
boolean isNew)
Create a DbaseFileWriter using the specified header and writing to the
given channel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(Feature feature)
Write a single dbase record.
|
void |
close()
Release resources associated with this writer.
|
void |
setCharset(java.nio.charset.Charset charset) |
void |
update(Feature feature,
long numReg)
Write a single dbase record.
|
public DbaseFileWriter(DbaseFileHeader header, java.nio.channels.FileChannel out, boolean isNew) throws InitializeException
header - The DbaseFileHeader to write.out - The Channel to write to.InitializeWriterExceptionjava.io.IOException - If errors occur while initializing.InitializeExceptionpublic void append(Feature feature) throws WriteException, UnsupportedEncodingException
record - The entries to write.UnsupportedEncodingExceptionWriteExceptionpublic void update(Feature feature, long numReg) throws WriteException, UnsupportedEncodingException
record - The entries to write.WriteExceptionUnsupportedEncodingExceptionpublic void close()
throws CloseException
CloseExceptionjava.io.IOException - If errors occur.public void setCharset(java.nio.charset.Charset charset)