The CSV records are read iteratively, regardless of whether the Iterable, the Iterator, or the Stream is used. Once all records are read, the data is consumed. If you need to repeatedly read records, you should collect the records in a List or another collection.
Example use:
try (CsvReader<CsvRecord> csv = CsvReader.builder().ofCsvRecord(file)) {
for (CsvRecord csvRecord : csv) {
// ...
}
}
Example for named records:
try (CsvReader<NamedCsvRecord> csv = CsvReader.builder().ofNamedCsvRecord(file)) {
for (NamedCsvRecord csvRecord : csv) {
// ...
}
}
| Modifier and Type | Class and Description |
|---|---|
| public static class | CsvReader.
This builder is used to create configured instances of |
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final boolean | |
| private final CsvCallbackHandler | |
| private final CommentStrategy | |
| private final CsvParser | |
| private final CloseableIterator | |
| private final boolean | |
| private int | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv | CsvReader(final CsvParser csvParser, final CsvCallbackHandler<T> callbackHandler, final CommentStrategy commentStrategy, final boolean skipEmptyLines, final boolean allowExtraFields, final boolean allowMissingFields)
|
| Modifier and Type | Method and Description |
|---|---|
| public static CsvReader. | Returns: a newCsvReaderBuilder instance.Constructs a |
| private String | |
| private void | |
| public void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
| private T | |
| private T | |
| public CloseableIterator | Returns: an iterator over elements of typeCsvRecord.Implements java. Returns an iterator over elements of type |
| private T | |
| public void | |
| public int | |
| public Spliterator | Returns: a spliterator over the CSV records.Overrides default java. Constructs a |
| public Stream | Returns: a sequentialStream over the CSV records.Constructs a new sequential |
| public String |