Skip to content

v1.3.0

Latest

Choose a tag to compare

@kasapdev kasapdev released this 07 Sep 20:06

Streaming CSV Reader

Adds CsvReader.stream(Reader), returning a new CsvStreamReader class: a genuinely
streaming, row-at-a-time CSV reading API for documents too large to comfortably load
into memory as a single List<List<String>>.

  • CsvStreamReader implements Iterator<List<String>>, Iterable<List<String>>, and
    Closeable — use it directly with hasNext()/next(), or as the target of an
    enhanced for loop.
  • Reads incrementally from the underlying Reader, never buffering more than the
    current row's fields.
  • Applies the exact same character-level dialect rules as CsvReader.parse(Reader):
    quoted fields, embedded commas/newlines (\n and \r\n), and escaped ("") quotes.

Testing

  • A new test parses a 50,000-row CSV (mixing plain, comma-quoted, newline-quoted, and
    escaped-quote fields) both through CsvReader.parse(Reader) and through
    CsvStreamReader, each driven from its own real FileReader over a temp file, and
    asserts the results are identical row-for-row.
  • A second new test proves the reader doesn't buffer the whole document up front, by
    tracking exact character consumption through a custom Reader and asserting only a
    small prefix is read after pulling the first row.
  • All existing CsvReaderTest and CsvWriterTest regression suites still pass
    unchanged.

See CHANGELOG.md
for full details.