Enum Class CsvDialect

java.lang.Object
java.lang.Enum<CsvDialect>
io.github.dornol.excelkit.csv.CsvDialect
All Implemented Interfaces:
Serializable, Comparable<CsvDialect>, Constable

public enum CsvDialect extends Enum<CsvDialect>
Predefined CSV dialect configurations for common formats.

Use with CsvWriter.dialect(CsvDialect) or CsvReader.dialect(CsvDialect) to quickly configure delimiter, charset, and BOM settings.


 // Tab-separated values
 CsvWriter.<Item>create()
     .dialect(CsvDialect.TSV)
     .column("Name", Item::name)
     .write(stream);

 // Excel-compatible CSV (UTF-8 BOM)
 CsvWriter.<Item>create()
     .dialect(CsvDialect.EXCEL)
     .column("Name", Item::name)
     .write(stream);
 
Since:
0.9.2
  • Enum Constant Details

    • RFC4180

      public static final CsvDialect RFC4180
      RFC 4180 standard: comma delimiter, UTF-8, no BOM.
    • EXCEL

      public static final CsvDialect EXCEL
      Excel-compatible: comma delimiter, UTF-8 with BOM for proper Korean/CJK display.
    • TSV

      public static final CsvDialect TSV
      Tab-separated values: tab delimiter, UTF-8, no BOM.
    • PIPE

      public static final CsvDialect PIPE
      Pipe-separated values: pipe delimiter, UTF-8, no BOM.
  • Method Details

    • values

      public static CsvDialect[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CsvDialect valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getDelimiter

      public char getDelimiter()
      Returns the field delimiter character.
      Returns:
      the delimiter character
    • getCharset

      public Charset getCharset()
      Returns the character encoding.
      Returns:
      the charset
    • isBom

      public boolean isBom()
      Returns whether a UTF-8 BOM should be written.
      Returns:
      true if BOM is enabled