public class CSVReader extends Generator<ArrayList<String>>
Lazy, forward-only CSV record generator with RFC-4180 style quoting.
Files are decoded incrementally through a reusable 64 KiB byte buffer. A borrowed TextReader is consumed one physical line at a time. Only the input buffer and the current record are retained, including for quoted fields containing delimiters, CR/LF newlines and escaped quotes. Records already returned remain independent of subsequent reads.
There is no size or random-access API. Use readRows() to explicitly collect the remaining records. A completed or closed reader cannot be restarted. for closes its generator on every exit, including break and exceptions.
import klyn.io.csv
try reader = CSVReader("contacts.csv", delimiter=';'):
reader.skip(1)
for row in reader:
print(row.join(" | "))| Modifier and Type | Member | Description |
|---|---|---|
| public override readonly property | current | Returns the record produced by the last successful next(), without advancing. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | CSVReader | Opens a CSV file without parsing its records. |
| public | CSVReader | Opens a CSV path without parsing its records. |
| public | CSVReader | Creates an unstarted CSV cursor over the remaining text of a reader. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | closeclose() as Void |
Closes this cursor idempotently and releases its buffers and current row. |
| public override | nextnext() as Boolean |
Parses exactly the next CSV record, which may span physical input lines. |
| public | readRows | Explicitly materializes all remaining records and exhausts this cursor. |
| public | rows | Alias for readRows(), explicitly collecting all remaining CSV records. |
| public | skipskip(count as Long) as Void |
Consumes the next count records without accumulating them. |