Interface ICsvMapWriter

All Superinterfaces:
AutoCloseable, Closeable, Flushable, ICsvWriter
All Known Implementing Classes:
CsvMapWriter

public interface ICsvMapWriter extends ICsvWriter
The interface for writers that write from Maps.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    write(Map<String,?> values, String... nameMapping)
    Writes the values of the Map as columns of a CSV file, using the supplied name mapping to map values to the appropriate columns.
    void
    write(Map<String,?> values, String[] nameMapping, CellProcessor[] processors)
    Writes the values of the Map as columns of a CSV file, using the supplied name mapping to map values to the appropriate columns.

    Methods inherited from interface java.io.Closeable

    close

    Methods inherited from interface java.io.Flushable

    flush

    Methods inherited from interface org.supercsv.io.ICsvWriter

    getLineNumber, getRowNumber, writeComment, writeHeader
  • Method Details

    • write

      void write(Map<String,?> values, String... nameMapping) throws IOException
      Writes the values of the Map as columns of a CSV file, using the supplied name mapping to map values to the appropriate columns. toString() will be called on each element prior to writing.
      Parameters:
      values - the Map containing the values to write
      nameMapping - an array of Strings linking the Map keys to their corresponding CSV columns (the array length should match the number of columns). A null entry in the array indicates that the column should be ignored (the column will be empty).
      Throws:
      IOException - if an I/O error occurred
      NullPointerException - if values or nameMapping are null
      SuperCsvException - if there was a general exception while writing
      Since:
      1.0
    • write

      void write(Map<String,?> values, String[] nameMapping, CellProcessor[] processors) throws IOException
      Writes the values of the Map as columns of a CSV file, using the supplied name mapping to map values to the appropriate columns. toString() will be called on each element prior to writing.
      Parameters:
      values - the Map containing the values to write
      nameMapping - an array of Strings linking the Map keys to their corresponding CSV columns (the array length should match the number of columns). A null entry in the array indicates that the column should be ignored (the column will be empty).
      processors - an array of CellProcessors used to further process data before it is written (each element in the processors array corresponds with a CSV column - the number of processors should match the number of columns). A null entry indicates no further processing is required (the value returned by toString() will be written as the column value).
      Throws:
      IOException - if an I/O error occurred
      NullPointerException - if values or nameMapping are null
      SuperCsvConstraintViolationException - if a CellProcessor constraint failed
      SuperCsvException - if there was a general exception while writing
      Since:
      1.20