public class CsvReader
extends java.lang.Object
Constructor and Description |
---|
CsvReader(java.util.function.Supplier<java.io.Reader> sourceSupplier) |
Modifier and Type | Method and Description |
---|---|
<T> RowsAsObjectParser<T> |
asRowsDefinedBy(java.lang.Class<T> clazz) |
<T> ColumnsVectorizedObjectParser<T> |
asVectorizedColumnsDefinedBy(java.lang.Class<T> clazz) |
CsvReader |
expectHeader(boolean expectHeader)
Tells the reader to either treat the first line of the file as a header or as data.
|
java.util.List<java.lang.String> |
getHeader()
Gets the header of the csv file if one exist otherwise an empty list.
|
java.util.List<java.util.List<java.lang.String>> |
readLines()
This will read the entire csv file and return it as a list.
|
java.util.stream.Stream<java.util.List<java.lang.String>> |
streamLines()
Read all lines from the csv file one at a time without ever holding
the entire csv file in memory
|
CsvReader |
withDelimiter(java.lang.String delimiter)
Defaults to a comma "," but could be \t for tab separated files or something else.
|
public CsvReader(java.util.function.Supplier<java.io.Reader> sourceSupplier)
public java.util.List<java.util.List<java.lang.String>> readLines()
public java.util.stream.Stream<java.util.List<java.lang.String>> streamLines()
public <T> RowsAsObjectParser<T> asRowsDefinedBy(java.lang.Class<T> clazz)
public <T> ColumnsVectorizedObjectParser<T> asVectorizedColumnsDefinedBy(java.lang.Class<T> clazz)
public java.util.List<java.lang.String> getHeader()
public CsvReader expectHeader(boolean expectHeader)
expectHeader
- true for first line is header, false for datapublic CsvReader withDelimiter(java.lang.String delimiter)
delimiter
- the delimiter to use