Interface RecordWriter<T>

Type Parameters:
T - The type of the Record instances being used.
All Superinterfaces:
AutoCloseable, HeaderAccessor<T>, org.refcodes.io.RowWriter<T[]>
All Known Implementing Classes:
CsvRecordWriter, CsvStringRecordWriter

public interface RecordWriter<T>
extends org.refcodes.io.RowWriter<T[]>, HeaderAccessor<T>
The RecordWriter writes data.
  • Method Details

    • parseHeader

      void parseHeader​(String... aHeader)
      Parses and sets the Header from the provided String. You must have provided a ColumnFactory for this operation to succeed.
      Parameters:
      aHeader - The header to be created.
    • writeHeader

      void writeHeader​(String... aHeader)
      Parses and sets the Header from the provided String arguments and writes the CSV header to the (standard) output (be it a Stream or a File). You must have provided a ColumnFactory for this operation to succeed.
      Parameters:
      aHeader - The header to be created.
    • writeHeader

      void writeHeader​(Header<T> aHeader)
      Sets and writes the provided Header to the (standard) output (be it a Stream or a File). .
      Parameters:
      aHeader - The header to be created.
    • writeHeader

      void writeHeader()
      Writes the CSV header to the (standard) output (be it a Stream or a File). You must have provided a Header for this operation to succeed.
    • writeNext

      void writeNext​(T... aRecord) throws IllegalArgumentException
      Directly logs the provided String instances to the (standard) output.
      Specified by:
      writeNext in interface org.refcodes.io.RowWriter<T>
      Parameters:
      aRecord - The String instances to be logged.
      Throws:
      IllegalArgumentException - thrown in case the provided objects do not align with the header (as of HeaderAccessor.getHeader()).
    • writeNext

      void writeNext​(Record<T> aRecord) throws ColumnMismatchException, HeaderMismatchException
      Directly logs the provided String instances to the (standard) output.
      Parameters:
      aRecord - The String instances to be logged.
      Throws:
      HeaderMismatchException - Thrown in case there is a mismatch between the given HeaderMismatchException and the Row, i.e. the index for the given key in the header may be out of index of the given row or the given key does not exist in the Header.
      ColumnMismatchException - Thrown in case a value was found in the e.g. in a Record of the wrong type than specified by a provided Column (of for example a Header).