Interface ICsvWriter

All Superinterfaces:
AutoCloseable, Closeable, Flushable
All Known Subinterfaces:
ICsvBeanWriter, ICsvListWriter, ICsvMapWriter, ICsvResultSetWriter
All Known Implementing Classes:
AbstractCsvWriter, CsvBeanWriter, CsvListWriter, CsvMapWriter, CsvResultSetWriter

public interface ICsvWriter extends Closeable, Flushable
The interface for CSV writers.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the current position in the file.
    int
    Gets the current row number (i.e.
    void
    Writes a single-line comment to the CSV file (the comment must already include any special comment characters e.g.
    void
    writeHeader(String... header)
    Writes the header of the CSV file.

    Methods inherited from interface java.io.Closeable

    close

    Methods inherited from interface java.io.Flushable

    flush
  • Method Details

    • getLineNumber

      int getLineNumber()
      Gets the current position in the file. The first line of the file is line number 1.
      Returns:
      the line number
      Since:
      1.0
    • getRowNumber

      int getRowNumber()
      Gets the current row number (i.e. the number of CSV records - including the header - that have been written). This differs from the lineNumber, which is the number of real lines that have been written to the file. The first row is row 1 (which is typically the header row).
      Returns:
      the current row number
      Since:
      2.0.0
    • writeComment

      void writeComment(String comment) throws IOException
      Writes a single-line comment to the CSV file (the comment must already include any special comment characters e.g. '#' at start). Please note that comments are not part of RFC4180, so this may make your CSV file less portable.
      Parameters:
      comment - the comment
      Throws:
      NullPointerException - if comment is null
      IOException - if an I/O error occurs
      Since:
      2.1.0
    • writeHeader

      void writeHeader(String... header) throws IOException
      Writes the header of the CSV file.
      Parameters:
      header - one or more header Strings
      Throws:
      NullPointerException - if header is null
      IOException - if an I/O error occurs
      Since:
      1.0