Class FixedLengthWriter

  • All Implemented Interfaces:
    RecordWriter

    public class FixedLengthWriter
    extends java.lang.Object
    implements RecordWriter
    A FixedLengthWriter is used to write records to fixed length flat file or output stream. A fixed length record is represented using the String class.
    Since:
    1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      FixedLengthWriter​(java.io.Writer out)
      Constructs a new FixedLegthWriter.
      FixedLengthWriter​(java.io.Writer out, java.lang.String recordTerminator)
      Constructs a new FixedLegthWriter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the output stream.
      void flush()
      Flushes the output stream.
      void write​(java.lang.Object value)
      Writes a record object to this output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FixedLengthWriter

        public FixedLengthWriter​(java.io.Writer out)
        Constructs a new FixedLegthWriter.
        Parameters:
        out - the output stream to write to
      • FixedLengthWriter

        public FixedLengthWriter​(java.io.Writer out,
                                 java.lang.String recordTerminator)
        Constructs a new FixedLegthWriter.
        Parameters:
        out - the output stream to write to
        recordTerminator - the text used to terminate a record
    • Method Detail

      • write

        public void write​(java.lang.Object value)
                   throws java.io.IOException,
                          RecordIOException
        Description copied from interface: RecordWriter
        Writes a record object to this output stream.
        Specified by:
        write in interface RecordWriter
        Parameters:
        value - the record object to write
        Throws:
        java.io.IOException - if an I/O error occurs writing the record to the stream
        RecordIOException
      • flush

        public void flush()
                   throws java.io.IOException
        Description copied from interface: RecordWriter
        Flushes the output stream.
        Specified by:
        flush in interface RecordWriter
        Throws:
        java.io.IOException - if an I/O error occurs flushing the stream
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: RecordWriter
        Closes the output stream.
        Specified by:
        close in interface RecordWriter
        Throws:
        java.io.IOException - if an I/O error occurs closing the stream