public final class CsvReader
extends java.lang.Object
| Constructor and Description |
|---|
CsvReader() |
| Modifier and Type | Method and Description |
|---|---|
CsvParser |
parse(java.io.File file,
java.nio.charset.Charset charset)
Constructs a new
CsvParser for the specified arguments. |
CsvParser |
parse(java.nio.file.Path path,
java.nio.charset.Charset charset)
Constructs a new
CsvParser for the specified arguments. |
CsvParser |
parse(java.io.Reader reader)
Constructs a new
CsvParser for the specified arguments. |
CsvContainer |
read(java.io.File file,
java.nio.charset.Charset charset)
Reads an entire file and returns a CsvContainer containing the data.
|
CsvContainer |
read(java.nio.file.Path path,
java.nio.charset.Charset charset)
Reads an entire file and returns a CsvContainer containing the data.
|
CsvContainer |
read(java.io.Reader reader)
Reads from the provided reader until the end and returns a CsvContainer containing the data.
|
void |
setContainsHeader(boolean containsHeader)
Specifies if the first line should be the header (default: false).
|
void |
setErrorOnDifferentFieldCount(boolean errorOnDifferentFieldCount)
Specifies if an exception should be thrown, if CSV data contains different field count
(default: false).
|
void |
setFieldSeparator(char fieldSeparator)
Sets the field separator character (default: ',' - comma).
|
void |
setSkipEmptyRows(boolean skipEmptyRows)
Specifies if empty rows should be skipped (default: true).
|
void |
setTextDelimiter(char textDelimiter)
Sets the text delimiter character (default: '"' - double quotes).
|
public void setFieldSeparator(char fieldSeparator)
public void setTextDelimiter(char textDelimiter)
public void setContainsHeader(boolean containsHeader)
public void setSkipEmptyRows(boolean skipEmptyRows)
public void setErrorOnDifferentFieldCount(boolean errorOnDifferentFieldCount)
public CsvContainer read(java.io.File file, java.nio.charset.Charset charset) throws java.io.IOException
file - the file to read data from.charset - the character set to use - must not be null.null.java.io.IOException - if an I/O error occurs.public CsvContainer read(java.nio.file.Path path, java.nio.charset.Charset charset) throws java.io.IOException
path - the file to read data from.charset - the character set to use - must not be null.null.java.io.IOException - if an I/O error occurs.public CsvContainer read(java.io.Reader reader) throws java.io.IOException
BufferedReader.
Performance may be even likely better if you do not.reader - the data source to read from.null.java.io.IOException - if an I/O error occurs.public CsvParser parse(java.nio.file.Path path, java.nio.charset.Charset charset) throws java.io.IOException
CsvParser for the specified arguments.path - the file to read data from.charset - the character set to use - must not be null.null.java.io.IOException - if an I/O error occurs.public CsvParser parse(java.io.File file, java.nio.charset.Charset charset) throws java.io.IOException
CsvParser for the specified arguments.file - the file to read data from.charset - the character set to use - must not be null.null.java.io.IOException - if an I/O error occurs.public CsvParser parse(java.io.Reader reader) throws java.io.IOException
CsvParser 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.reader - the data source to read from.null.java.io.IOException - if an I/O error occurs.