|
16 | 16 | */ |
17 | 17 | package org.apache.commons.csv; |
18 | 18 |
|
19 | | -import java.io.IOException; |
20 | | -import java.io.InputStream; |
21 | | -import java.io.InputStreamReader; |
22 | | -import java.io.Reader; |
| 19 | +import java.io.*; |
23 | 20 | import java.util.ArrayList; |
24 | 21 |
|
25 | 22 |
|
26 | 23 | /** |
27 | | - * Parses cvs files according to the specified configuration. |
| 24 | + * Parses CSV files according to the specified configuration. |
28 | 25 | * |
29 | | - * Because CSV appears in many different dialects the parser supports many |
30 | | - * configuration settings. One of the most popular CSV format as supported |
31 | | - * by the M$ corporation (excel-spreadsheets) are supported out-of-the-box |
32 | | - * by the corresponding strategy setter (see {@link #setExcelStrategy()}). |
| 26 | + * Because CSV appears in many different dialects, the parser supports many |
| 27 | + * configuration settings by allowing the specification of a {@link CSVStrategy}. |
33 | 28 | * |
34 | | - * <p>Parsing of a csv-string having ';' as separator:</p> |
| 29 | + * <p>Parsing of a csv-string having tabs as separators, |
| 30 | + * '"' as an optional value encapsulator, and comments starting with '#':</p> |
35 | 31 | * <pre> |
36 | 32 | * String[][] data = |
37 | | - * (new CSVParser(new StringReader("a;b\nc;d"),';')).getAllValues(); |
| 33 | + * (new CSVParser(new StringReader("a\tb\nc\td"), new CSVStrategy('\t','"','#'))).getAllValues(); |
38 | 34 | * </pre> |
39 | 35 | * |
40 | | - * <p>The API allows chained method calls, if you like this coding style:</p> |
| 36 | + * <p>Parsing of a csv-string in Excel CSV format</p> |
41 | 37 | * <pre> |
42 | | - * String[][] data = (new CSVParser(new StringReader("a;b\nc;d"),';')) |
43 | | - * .setExcelStrategy().setIgnoreEmptyLines(true).getAllValues(); |
| 38 | + * String[][] data = |
| 39 | + * (new CSVParser(new StringReader("a;b\nc;d"), CSVStrategy.EXCEL_STRATEGY)).getAllValues(); |
44 | 40 | * </pre> |
45 | 41 | * |
46 | 42 | * <p> |
|
0 commit comments