Class CsvWriter

    • Field Detail

      • 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 java.util.Set<java.lang.Integer> quotedColumns
      • quoteNulls

        private boolean quoteNulls
    • Constructor Detail

      • 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​(java.io.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​(java.io.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​(java.io.File file,
                         java.lang.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​(java.io.File file,
                         java.nio.charset.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​(java.io.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​(java.io.OutputStream output,
                         java.lang.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​(java.io.OutputStream output,
                         java.nio.charset.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 Detail

      • matchMultiDelimiter

        private boolean matchMultiDelimiter​(java.lang.String element,
                                            int from)
      • quoteElement

        private boolean quoteElement​(int start,
                                     java.lang.String element)
      • append

        private boolean append​(int columnIndex,
                               boolean isElementQuoted,
                               boolean allowTrim,
                               java.lang.String element)
      • appendQuoted

        private void appendQuoted​(int start,
                                  boolean allowTrim,
                                  java.lang.String element)