Class CSVFormat

java.lang.Object
org.jooq.CSVFormat

public final class CSVFormat extends Object
A CSV formatting type, which can be used to configure CSV imports / exports.

The type is immutable, meaning calls to setters like delimiter(char) do not modify the original reference, but return a new one instead.

Author:
Lukas Eder
  • Field Details

    • DEFAULT

      public static final CSVFormat DEFAULT
  • Constructor Details

    • CSVFormat

      public CSVFormat()
  • Method Details

    • redacted

      @NotNull @Pro public @NotNull CSVFormat redacted(String newRedacted)
      The string value to show for redacted content.
    • redacted

      @Pro public String redacted()
      The string value to show for redacted content.
    • delimiter

      @NotNull public @NotNull CSVFormat delimiter(String newDelimiter)
      The delimiter to be used between CSV cells, defaulting to ",".

      Using "," a,b,c
      Using ";" a;b;c
    • delimiter

      @NotNull public @NotNull CSVFormat delimiter(char newDelimiter)
      The delimiter to be used between CSV cells, defaulting to ",".

      Using "," a,b,c
      Using ";" a;b;c
    • delimiter

      @NotNull public @NotNull String delimiter()
      The delimiter to be used between CSV cells, defaulting to ",".

      Using "," a,b,c
      Using ";" a;b;c
    • nullString

      @NotNull public @NotNull CSVFormat nullString(String newNullString)
      The string to be used for null values, defaulting to the empty string.

      Using "" a,,c
      Using "\"\"" a,"",c
      Using "{null}" a,{null},c
    • nullString

      @NotNull public @NotNull String nullString()
      The string to be used for null values, defaulting to the empty string.

      Using "" a,,c
      Using "\"\"" a,"",c
      Using "{null}" a,{null},c
    • emptyString

      @NotNull public @NotNull CSVFormat emptyString(String newEmptyString)
      The string to be used for "" values, defaulting to the empty string.

      Using "" a,,c
      Using "\"\"" a,"",c
    • emptyString

      @NotNull public @NotNull String emptyString()
      The string to be used for "" values, defaulting to the empty string.

      Using "" a,,c
      Using "\"\"" a,"",c
    • newline

      @NotNull public @NotNull CSVFormat newline(String newNewline)
      The string to be used to separate rows, defaulting to \n.
    • newline

      @NotNull public @NotNull String newline()
      The string to be used to separate rows, defaulting to \n.
    • quoteString

      @NotNull public @NotNull CSVFormat quoteString(String newQuoteString)
      The string used to quote values according to the rules specified in quote().
    • quoteString

      @NotNull public @NotNull String quoteString()
      The string used to quote values according to the rules specified in quote().
    • quote

      @NotNull public @NotNull CSVFormat quote(CSVFormat.Quote newQuote)
      When to quote CSV content.
    • quote

      @NotNull public @NotNull CSVFormat.Quote quote()
      When to quote CSV content.
    • header

      @NotNull public @NotNull CSVFormat header(boolean newHeader)
      Whether to emit a header row with column names, defaulting to true.
    • header

      public boolean header()
      Whether to emit a header row with column names, defaulting to true.
    • quoteBackslashes

      @NotNull public @NotNull CSVFormat quoteBackslashes(boolean newQuoteBackslashes)
      Whether to escape backslashes as \\ and treat them as special characters for CSVFormat.Quote.SPECIAL_CHARACTERS, defaulting to true.

      RFC 4180 does not specify the backslash as an escape character, so false produces RFC compliant output. The default of true retains the historic behaviour of jOOQ.

      Using true "back\\slash"
      Using false back\slash
    • quoteBackslashes

      public boolean quoteBackslashes()
      Whether to escape backslashes as \\ and treat them as special characters for CSVFormat.Quote.SPECIAL_CHARACTERS, defaulting to true.

      RFC 4180 does not specify the backslash as an escape character, so false produces RFC compliant output. The default of true retains the historic behaviour of jOOQ.