Class IndexedCsvReader<T>

java.lang.Object
de.siegmar.fastcsv.reader.IndexedCsvReader<T>
Type Parameters:
T - the type of the CSV record.
All Implemented Interfaces:
Closeable, AutoCloseable

public final class IndexedCsvReader<T> extends Object implements Closeable
CSV reader implementation for indexed based access.

If no prebuilt index passed in (via IndexedCsvReader.IndexedCsvReaderBuilder.index(CsvIndex)) the constructor will initiate indexing the file. This process is optimized on performance and low memory usage – no CSV data is stored in memory. The current status can be monitored via IndexedCsvReader.IndexedCsvReaderBuilder.statusListener(StatusListener).

This class is thread-safe.

Example use:

 try (IndexedCsvReader<CsvRecord> csv = IndexedCsvReader.builder().ofCsvRecord(file)) {
     CsvIndex index = csv.getIndex();
     int lastPage = index.getPageCount() - 1;
     List<CsvRecord> csvRecords = csv.readPage(lastPage);
 }