Class DbaseFileWriter

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class DbaseFileWriter
    extends Object
    implements Closeable
    A DbaseFileWriter is used to write 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
    • 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.
        Throws:
        IOException - If errors occur while initializing.
      • DbaseFileWriter

        public DbaseFileWriter​(DbaseFileHeader header,
                               WritableByteChannel out,
                               Charset charset,
                               TimeZone timeZone)
                        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

      • getReportFieldSizeErrors

        public boolean getReportFieldSizeErrors()
      • setReportFieldSizeErrors

        public void setReportFieldSizeErrors​(boolean reportFieldSizeErrors)