![](https://camo.githubusercontent.com/365a269ff418d24bdf194ab15958a7545e2d9cc794be9e42933e57519e315b51/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d53706f6e736f72266d6573736167653d254532253944254134266c6f676f3d47697448756226636f6c6f723d253233666538653836)
![Label](https://camo.githubusercontent.com/dde338dfed8e37fc7c42b405771c0a7a51e38ddd9db611ab1dddb1f001f716fd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f59756e612d517565656e496e736964652d626c756576696f6c65743f7374796c653d666c61742d737175617265)
Lazy CSV reader: plain java, no dependencies, streaming, resource reader, unzip, autodetect delimiters, Immutable,
InnerCSV NullPointerException or IndexOutOfBoundsException
ClassName |
UsageType |
Description |
StreamCSV |
static |
Stream methods (lazy) |
ConsumeCSV |
static |
Consumer methods (lazy) |
ListCsv |
static |
List methods (in memory) |
CsvReader |
Object |
Configurable reader |
Options |
Type |
Default |
Description |
Skip |
long |
-1 |
Lines to skip while reading csv |
charset |
Charset |
UTF_8 |
Charset to use for decoding the CSV file |
unzip |
boolean |
false |
On true detects and extracts the CSV file automatically |
autoSep |
boolean |
false |
On true detects the separator automatically |
separators |
char... |
',' |
Splits the CSV rows at the given separator |
final List<CsvRow> csvList = ListCsv.listCsv(EXAMPLE_CSV);
ConsumeCSV.consumeCsv(EXAMPLE_CSV,System.out::println);
try(final Stream<CsvRow> csvStream = StreamCSV.streamCSV(EXAMPLE_CSV)){
csvStream.forEach(System.out::println);
}
import static berlin.yuna.logic.CsvReader.csvReader;
public class CsvReaderTest {
//configuration
CsvReader reader = csvReader().skipLines(1).charset(UTF_8).separator(';').unzip(true).autoSep(true);
//read
List<CsvRow> allLines = reader.readAllRows(EXAMPLE_CSV);
//consume
reader.consume(EXAMPLE_CSV,System.out::println);
//stream
try(final Stream<CsvRow> lazyStream = reader.streamCSV(EXAMPLE_CSV)){
lazyStream.forEach(System.out::println);
}
}
final List<CsvRow> csvRows = ListCSV.listCSV(EXAMPLE_CSV)
final CsvRow firstColumn = csvRows.get(0);
final CsvRow innerCSV = firstColumn.get(0, ',');