| Modifier and Type | Method and Description |
|---|---|
CsvWriter |
build(java.nio.file.Path path,
java.nio.charset.Charset charset,
java.nio.file.OpenOption... openOptions)
Constructs a
CsvWriter for the specified Path. |
CsvWriter |
build(java.io.Writer writer)
Constructs a
CsvWriter for the specified Writer. |
CsvWriter.CsvWriterBuilder |
fieldSeparator(char fieldSeparator)
Sets the character that is used to separate columns (default: ',' - comma).
|
CsvWriter.CsvWriterBuilder |
lineDelimiter(LineDelimiter lineDelimiter)
Sets the delimiter that is used to separate lines (default:
LineDelimiter.CRLF). |
CsvWriter.CsvWriterBuilder |
quoteCharacter(char quoteCharacter)
Sets the character that is used to quote values (default: '"' - double quotes).
|
CsvWriter.CsvWriterBuilder |
quoteStrategy(QuoteStrategy quoteStrategy)
Sets the strategy that defines when quoting has to be performed
(default:
QuoteStrategy.REQUIRED). |
public CsvWriter.CsvWriterBuilder fieldSeparator(char fieldSeparator)
fieldSeparator - the field separator character.public CsvWriter.CsvWriterBuilder quoteCharacter(char quoteCharacter)
quoteCharacter - the character for enclosing fields.public CsvWriter.CsvWriterBuilder quoteStrategy(QuoteStrategy quoteStrategy)
QuoteStrategy.REQUIRED).quoteStrategy - the strategy when fields should be enclosed using the.public CsvWriter.CsvWriterBuilder lineDelimiter(LineDelimiter lineDelimiter)
LineDelimiter.CRLF).lineDelimiter - the line delimiter to be used.public CsvWriter build(java.io.Writer writer)
CsvWriter for the specified Writer.
This library uses built-in buffering but writes its internal buffer to the given
writer on every CsvWriter.writeRow(String...) or
CsvWriter.writeRow(Iterable) call. Therefore you probably want to pass in a
BufferedWriter to retain good performance.
Use build(Path, Charset, OpenOption...) for optimal performance when writing
files.
writer - the Writer to use for writing CSV data.null.java.lang.NullPointerException - if writer is nullpublic CsvWriter build(java.nio.file.Path path, java.nio.charset.Charset charset, java.nio.file.OpenOption... openOptions) throws java.io.IOException
CsvWriter for the specified Path.path - the path to write data to.charset - the character set to be used for writing data to the file.openOptions - options specifying how the file is opened.
See Files.newOutputStream(Path, OpenOption...) for defaults.null. Don't forget to close it!java.io.IOException - if a write error occursjava.lang.NullPointerException - if path or charset is null