Class CsvWriter

All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public final class CsvWriter extends SerializerWriter
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.
      Parameters:
      value - The value to write.
    • appendln

      public CsvWriter appendln(int indent, String text)
      Description copied from class: SerializerWriter
      Writes an indent (if the useWhitespace setting is enabled), followed by text, followed by a newline (if the useWhitespace setting is enabled).
      Overrides:
      appendln in class SerializerWriter
      Parameters:
      indent - The number of tabs to indent.
      text - The text to write.
      Returns:
      This object.
    • appendln

      public CsvWriter appendln(String text)
      Description copied from class: SerializerWriter
      Writes the specified text followed by a newline (if the useWhitespace setting is enabled).
      Overrides:
      appendln in class SerializerWriter
      Parameters:
      text - The text to write.
      Returns:
      This object.
    • append

      public CsvWriter append(int indent, String text)
      Description copied from class: SerializerWriter
      Writes an indent (if the useWhitespace setting is enabled), followed by text.
      Overrides:
      append in class SerializerWriter
      Parameters:
      indent - The number of tabs to indent.
      text - The text to write.
      Returns:
      This object.
    • append

      public CsvWriter append(int indent, char c)
      Description copied from class: SerializerWriter
      Writes an indent (if the useWhitespace setting is enabled), followed by text.
      Overrides:
      append in class SerializerWriter
      Parameters:
      indent - The number of tabs to indent.
      c - The character to write.
      Returns:
      This object.
    • s

      public CsvWriter s()
      Description copied from class: SerializerWriter
      Adds a whitespace character to the output if the useWhitespace setting is enabled.
      Overrides:
      s in class SerializerWriter
      Returns:
      This object.
    • q

      public CsvWriter q()
      Description copied from class: SerializerWriter
      Adds the quote character specified by the quoteChar setting to the output.
      Overrides:
      q in class SerializerWriter
      Returns:
      This object.
    • i

      public CsvWriter i(int indent)
      Description copied from class: SerializerWriter
      Writes an indent to the writer if the useWhitespace setting is enabled.
      Overrides:
      i in class SerializerWriter
      Parameters:
      indent - The number of tabs to indent.
      Returns:
      This object.
    • nl

      public CsvWriter nl(int indent)
      Description copied from class: SerializerWriter
      Writes a newline to the writer if the useWhitespace setting is enabled.
      Overrides:
      nl in class SerializerWriter
      Parameters:
      indent - The current indentation level.
      Returns:
      This object.
    • append

      public CsvWriter append(Object text)
      Description copied from class: SerializerWriter
      Writes the specified text to the writer if it isn't null.
      Overrides:
      append in class SerializerWriter
      Parameters:
      text - The text to write.
      Returns:
      This object.
    • append

      public CsvWriter append(String text)
      Description copied from class: SerializerWriter
      Writes the specified text to the writer if it isn't null.
      Overrides:
      append in class SerializerWriter
      Parameters:
      text - The text to write.
      Returns:
      This object.
    • appendIf

      public CsvWriter appendIf(boolean b, String text)
      Description copied from class: SerializerWriter
      Writes the specified text to the writer if b is true.
      Overrides:
      appendIf in class SerializerWriter
      Parameters:
      b - Boolean flag.
      text - The text to write.
      Returns:
      This object.
    • appendIf

      public CsvWriter appendIf(boolean b, char c)
      Description copied from class: SerializerWriter
      Writes the specified text to the writer if b is true.
      Overrides:
      appendIf in class SerializerWriter
      Parameters:
      b - Boolean flag.
      c - The text to write.
      Returns:
      This object.
    • append

      public CsvWriter append(char c)
      Specified by:
      append in interface Appendable
      Overrides:
      append in class SerializerWriter