Package org.h2gis.functions.io.dbf.internal

## Class DbaseFileWriter

- java.lang.Object
- - org.h2gis.functions.io.dbf.internal.DbaseFileWriter

    public class DbaseFileWriter
    extends 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(&quot;thefile.dbf&quot;).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
See Also:
  DbaseFileWriter.java

### Nested Class Summary

Nested Classes
`static class` `DbaseFileWriter.FieldFormatter` Utility for formatting Dbase fields.

### Constructor Summary

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

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Release resources associated with this writer.
`DbaseFileHeader` `getHeader()`
`void` `write​(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

#### DbaseFileWriter

    public DbaseFileWriter​(DbaseFileHeader header,
                           WritableByteChannel out)
                    throws 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:
  `IOException` - If errors occur while initializing.

#### DbaseFileWriter

    public DbaseFileWriter​(DbaseFileHeader header,
                           WritableByteChannel out,
                           Charset charset)
                    throws 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.
  `charset` - The charset the dbf is (will be) encoded in
Throws:
  `IOException` - If errors occur while initializing.

### Method Detail

#### getHeader

    public DbaseFileHeader getHeader()

Returns:
  The DbaseFileHeader to write.

#### write

    public void write​(Object[] record)
               throws IOException,
                      DbaseFileException

Write a single dbase record.

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

#### close

    public void close()
               throws IOException

Release resources associated with this writer. Highly recommended

Throws:
  `IOException` - If errors occur.