com.iver.cit.gvsig.fmap.drivers.shp
Class DbaseFileWriterNIO

java.lang.Object
  extended bycom.iver.cit.gvsig.fmap.drivers.shp.DbaseFileWriterNIO

public class DbaseFileWriterNIO
extends java.lang.Object

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

 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...

Author:
Ian Schneider

Nested Class Summary
static class DbaseFileWriterNIO.FieldFormatter
          Utility for formatting Dbase fields.
 
Constructor Summary
DbaseFileWriterNIO(DbaseFileHeaderNIO header, java.nio.channels.WritableByteChannel out)
          Create a DbaseFileWriter using the specified header and writing to the given channel.
 
Method Summary
 void close()
          Release resources associated with this writer.
 void write(java.lang.Object[] record)
          Write a single dbase record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbaseFileWriterNIO

public DbaseFileWriterNIO(DbaseFileHeaderNIO header,
                          java.nio.channels.WritableByteChannel out)
                   throws java.io.IOException
Create a DbaseFileWriter using the specified header and writing to the given channel.

Parameters:
header - The DbaseFileHeader to write.
out - The Channel to write to.
Throws:
java.io.IOException - If errors occur while initializing.
Method Detail

write

public void write(java.lang.Object[] record)
           throws java.io.IOException
Write a single dbase record.

Parameters:
record - The entries to write.
Throws:
java.io.IOException - If IO error occurs.
DbaseFileException - If the entry doesn't comply to the header.

close

public void close()
           throws java.io.IOException
Release resources associated with this writer. Highly recommended

Throws:
java.io.IOException - If errors occur.