Class CsvWriter

All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class CsvWriter extends SerializerWriter<CsvWriter>
Specialized writer for serializing CSV.
Notes:
  • This class is not intended for external use.
  • Constructor Details

    • CsvWriter

      protected CsvWriter(Writer out, boolean useWhitespace, int maxIndent, char quoteChar, boolean trimStrings, UriResolver uriResolver)
      Constructor.
      Parameters:
      out - The writer being wrapped.
      useWhitespace - If true, tabs and spaces will be used in output.
      maxIndent - The maximum indentation level.
      quoteChar - The quote character to use (i.e. '\'' or '"')
      trimStrings - If true, strings will be trimmed before being serialized.
      uriResolver - The URI resolver for resolving URIs to absolute or root-relative form.
  • Method Details

    • writeEntry

      public void writeEntry(Object value)
      Writes an entry to the writer.

      Follows RFC 4180 quoting rules:

      • Values containing commas, double-quote characters, or newlines are enclosed in double quotes.
      • Double-quote characters within a quoted field are escaped by preceding them with another double-quote.
      • The literal string null is written unquoted; the string value "null" is quoted.
      Parameters:
      value - The value to write.
      Can be null (written as the literal "null").