Class CsvWriter


public class CsvWriter extends AbstractWriter<CsvWriterSettings>
A powerful and flexible CSV writer implementation.
See Also:
  • Field Details

    • delimiter

      private char delimiter
    • multiDelimiter

      private char[] multiDelimiter
    • quoteChar

      private char quoteChar
    • escapeChar

      private char escapeChar
    • escapeEscape

      private char escapeEscape
    • quoteAllFields

      private boolean quoteAllFields
    • escapeUnquoted

      private boolean escapeUnquoted
    • inputNotEscaped

      private boolean inputNotEscaped
    • newLine

      private char newLine
    • dontProcessNormalizedNewLines

      private boolean dontProcessNormalizedNewLines
    • quotationTriggers

      private boolean[] quotationTriggers
    • maxTrigger

      private char maxTrigger
    • quotedColumns

      private Set<Integer> quotedColumns
    • quotedFieldSelector

      private FieldSelector quotedFieldSelector
    • quoteNulls

      private boolean quoteNulls
  • Constructor Details

    • CsvWriter

      public CsvWriter(CsvWriterSettings settings)
      The CsvWriter supports all settings provided by CsvWriterSettings, and requires this configuration to be properly initialized.

      Important: by not providing an instance of Writer to this constructor, only the operations that write to Strings are available.

      Parameters:
      settings - the CSV writer configuration
    • CsvWriter

      public CsvWriter(Writer writer, CsvWriterSettings settings)
      The CsvWriter supports all settings provided by CsvWriterSettings, and requires this configuration to be properly initialized.
      Parameters:
      writer - the output resource that will receive CSV records produced by this class.
      settings - the CSV writer configuration
    • CsvWriter

      public CsvWriter(File file, CsvWriterSettings settings)
      The CsvWriter supports all settings provided by CsvWriterSettings, and requires this configuration to be properly initialized.
      Parameters:
      file - the output file that will receive CSV records produced by this class.
      settings - the CSV writer configuration
    • CsvWriter

      public CsvWriter(File file, String encoding, CsvWriterSettings settings)
      The CsvWriter supports all settings provided by CsvWriterSettings, and requires this configuration to be properly initialized.
      Parameters:
      file - the output file that will receive CSV records produced by this class.
      encoding - the encoding of the file
      settings - the CSV writer configuration
    • CsvWriter

      public CsvWriter(File file, Charset encoding, CsvWriterSettings settings)
      The CsvWriter supports all settings provided by CsvWriterSettings, and requires this configuration to be properly initialized.
      Parameters:
      file - the output file that will receive CSV records produced by this class.
      encoding - the encoding of the file
      settings - the CSV writer configuration
    • CsvWriter

      public CsvWriter(OutputStream output, CsvWriterSettings settings)
      The CsvWriter supports all settings provided by CsvWriterSettings, and requires this configuration to be properly initialized.
      Parameters:
      output - the output stream that will be written with the CSV records produced by this class.
      settings - the CSV writer configuration
    • CsvWriter

      public CsvWriter(OutputStream output, String encoding, CsvWriterSettings settings)
      The CsvWriter supports all settings provided by CsvWriterSettings, and requires this configuration to be properly initialized.
      Parameters:
      output - the output stream that will be written with the CSV records produced by this class.
      encoding - the encoding of the stream
      settings - the CSV writer configuration
    • CsvWriter

      public CsvWriter(OutputStream output, Charset encoding, CsvWriterSettings settings)
      The CsvWriter supports all settings provided by CsvWriterSettings, and requires this configuration to be properly initialized.
      Parameters:
      output - the output stream that will be written with the CSV records produced by this class.
      encoding - the encoding of the stream
      settings - the CSV writer configuration
  • Method Details