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.WritableByteChannel out)
Creates 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.
|
void |
write(java.lang.Object[] record)
Write a single dBase record.
|
public DbaseFileWriter(DbaseFileHeader header, java.nio.channels.WritableByteChannel out) throws java.io.IOException
header
- The DbaseFileHeader to write.out
- The channel to write to.java.io.IOException
- If errors occur while initializing.public void write(java.lang.Object[] record) throws java.io.IOException
record
- The entries to write.java.io.IOException
- If IO error occurs or the entry doesn't comply with the header.public void close() throws java.io.IOException
java.io.IOException
- If problem releasing all resources.