public class CsvReader extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
CsvReader() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
autoSep() |
CsvReader |
autoSep(boolean autoSep) |
Charset |
charset() |
CsvReader |
charset(Charset charset) |
void |
consume(Path file,
Consumer<CsvIndexRow> consumer) |
static CsvReader |
csvReader() |
List<CsvRow> |
readAllRows(Path file) |
char[] |
separator() |
CsvReader |
separator(char... separator) |
long |
skipLines() |
CsvReader |
skipLines(long skipLines) |
Stream<CsvRow> |
stream(Path file)
|
boolean |
unzip() |
CsvReader |
unzip(boolean unzip) |
public void consume(Path file, Consumer<CsvIndexRow> consumer)
file - the path to the file - or path to a resourceconsumer - consumes rowpublic List<CsvRow> readAllRows(Path file)
file - the path to the file - or path to a resourceCsvRow from the file as a Streampublic Stream<CsvRow> stream(Path file)
Stream<CsvRow>' must be closed with 'try'-with-resources statement
The returned stream encapsulates a Reader. If timely
disposal of file system resources is required, the try-with-resources
construct should be used to ensure that the stream's
close method is invoked after the stream operations
are completed.
See example: readAllRows(Path)
file - the path to the file - or path to a resourceCsvRow from the file as a Streampublic char[] separator()
public CsvReader separator(char... separator)
separator - Splits the CSV rows at the given separator CsvReader]public boolean autoSep()
public CsvReader autoSep(boolean autoSep)
autoSep - - On true detects the separator automaticallyCsvReader]public boolean unzip()
public CsvReader unzip(boolean unzip)
unzip - - On true detects and unzips the CSV file automaticallyCsvReader]public Charset charset()
public CsvReader charset(Charset charset)
charset - The charset to use for decoding the CSV fileCsvReader]public long skipLines()
Copyright © 2023. All rights reserved.