Class | Description |
---|---|
CSVFormat |
Specifies the format of a CSV file and parses input.
|
CSVParser |
Parses CSV files according to the specified format.
|
CSVPrinter |
Prints values in a
CSV format . |
CSVRecord |
A CSV record parsed from a CSV file.
|
Enum | Description |
---|---|
CSVFormat.Predefined |
Predefines formats.
|
QuoteMode |
Defines quoting behavior when printing.
|
CSV are widely used as interfaces to legacy systems or manual data-imports. CSV stands for "Comma Separated Values" (or sometimes "Character Separated Values"). The CSV data format is defined in RFC 4180 but many dialects exist.
Common to all file dialects is its basic structure: The CSV data-format is record oriented, whereas each record starts on a new textual line. A record is build of a list of values. Keep in mind that not all records must have an equal number of values:
csv := records* record := values*
The following list contains the CSV aspects the Commons CSV parser supports:
In addition to individually defined dialects, two predefined dialects (strict-csv, and excel-csv) can be set directly.
Example usage:
Reader in = new StringReader("a,b,c"); for (CSVRecord record : CSVFormat.DEFAULT.parse(in)) { for (String field : record) { System.out.print("\"" + field + "\", "); } System.out.println(); }
Copyright © 2019 The Apache Software Foundation. All rights reserved.