Class CsvStarTable

All Implemented Interfaces:
Closeable, AutoCloseable, StarTable

public class CsvStarTable extends StreamStarTable
Comma-Separated Value table. This reader tries to read data in the semi-standard CSV format. The intention is that it understands the version of that dialect spoken by MS Excel, though the documentation on which it is based was not obtained directly from MicroSoft.

Here are the rules:

  • Each row must have the same number of comma-separated fields.
  • Whitespace (space or tab) adjacent to a comma is ignored.
  • Adjacent commas, or a comma at the start or end of a line (whitespace apart) indicates a null field.
  • Lines are terminated by any sequence of carriage-return or newline characters ('\r' or '\n') (a corollary of this is that blank lines are ignored).
  • Cells may be enclosed in double quotes; quoted values may contain linebreaks (or any other character); a double quote character within a quoted value is represented by two adjacent double quotes.
  • The first line may be a header line containing column names rather than a row of data. Exactly the same syntactic rules are followed for such a row as for data rows.
Since:
21 Sep 2004
Author:
Mark Taylor (Starlink)