public static final class NamedCsvReader.NamedCsvReaderBuilder
extends java.lang.Object
NamedCsvReader. The default
configuration of this class complies with RFC 4180.
The line delimiter (line-feed, carriage-return or the combination of both) is detected automatically and thus not configurable.
| Modifier and Type | Method and Description |
|---|---|
NamedCsvReader |
build(java.nio.file.Path path)
Constructs a new
NamedCsvReader for the specified path using UTF-8 as the character set. |
NamedCsvReader |
build(java.nio.file.Path path,
java.nio.charset.Charset charset)
Constructs a new
NamedCsvReader for the specified arguments. |
NamedCsvReader |
build(java.io.Reader reader)
Constructs a new
NamedCsvReader for the specified arguments. |
NamedCsvReader |
build(java.lang.String data)
Constructs a new
NamedCsvReader for the specified arguments. |
NamedCsvReader.NamedCsvReaderBuilder |
commentCharacter(char commentCharacter)
Sets the
commentCharacter used to comment lines. |
NamedCsvReader.NamedCsvReaderBuilder |
fieldSeparator(char fieldSeparator)
Sets the
fieldSeparator used when reading CSV data. |
NamedCsvReader.NamedCsvReaderBuilder |
quoteCharacter(char quoteCharacter)
Sets the
quoteCharacter used when reading CSV data. |
NamedCsvReader.NamedCsvReaderBuilder |
skipComments(boolean skipComments)
Defines if commented rows should be detected and skipped when reading data.
|
java.lang.String |
toString() |
public NamedCsvReader.NamedCsvReaderBuilder fieldSeparator(char fieldSeparator)
fieldSeparator used when reading CSV data.fieldSeparator - the field separator character (default: , - comma).public NamedCsvReader.NamedCsvReaderBuilder quoteCharacter(char quoteCharacter)
quoteCharacter used when reading CSV data.quoteCharacter - the character used to enclose fields
(default: " - double quotes).public NamedCsvReader.NamedCsvReaderBuilder commentCharacter(char commentCharacter)
commentCharacter used to comment lines.commentCharacter - the character used to comment lines (default: # - hash)skipComments(boolean)public NamedCsvReader.NamedCsvReaderBuilder skipComments(boolean skipComments)
skipComments - if commented rows should be skipped (default: true).public NamedCsvReader build(java.nio.file.Path path) throws java.io.IOException
NamedCsvReader for the specified path using UTF-8 as the character set.path - the file to read data from.null. Don't forget to close it!java.io.IOException - if an I/O error occurs.java.lang.NullPointerException - if path or charset is nullpublic NamedCsvReader build(java.nio.file.Path path, java.nio.charset.Charset charset) throws java.io.IOException
NamedCsvReader for the specified arguments.path - the file to read data from.charset - the character set to use.null. Don't forget to close it!java.io.IOException - if an I/O error occurs.java.lang.NullPointerException - if path or charset is nullpublic NamedCsvReader build(java.io.Reader reader)
NamedCsvReader for the specified arguments.
This library uses built-in buffering, so you do not need to pass in a buffered Reader
implementation such as BufferedReader. Performance may be even likely
better if you do not.
Use build(Path, Charset) for optimal performance when
reading files and build(String) when reading Strings.
reader - the data source to read from.null.java.lang.NullPointerException - if reader is nullpublic NamedCsvReader build(java.lang.String data)
NamedCsvReader for the specified arguments.data - the data to read.null.public java.lang.String toString()
toString in class java.lang.Object