Author: ggregory Date: Tue Mar 26 16:36:58 2013 New Revision: 1461213 URL: http://svn.apache.org/r1461213 Log: Javadoc.
Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1461213&r1=1461212&r2=1461213&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Tue Mar 26 16:36:58 2013 @@ -36,28 +36,40 @@ import java.util.NoSuchElementException; * specification of a {@link CSVFormat}. * * <p> - * Parsing of a csv-string having tabs as separators, '"' as an optional value encapsulator, and comments starting with - * '#': + * To parse a CSV input with tabs as separators, '"' (double-quote) as an optional value encapsulator, + * and comments starting with '#', you write: * </p> * * <pre> - * CSVFormat format = new CSVFormat('\t', '"', '#'); * Reader in = new StringReader("a\tb\nc\td"); - * List<CSVRecord> records = new CSVParser(in, format).getRecords(); + * Iterable<CSVRecord> parser = CSVFormat.newBuilder() + * .withCommentStart('#') + * .withDelimiter('\t') + * .withQuoteChar('"').parse(in); + * for (CSVRecord csvRecord : parse) { + * ... + * } * </pre> * * <p> - * Parsing of a csv-string in Excel CSV format, using a for-each loop: + * To parse CSV input in a given format like Excel, you write: * </p> * * <pre> * Reader in = new StringReader("a;b\nc;d"); - * CSVParser parser = new CSVParser(in, CSVFormat.EXCEL); + * Iterable<CSVRecord> parser = CSVFormat.EXCEL.parse(in); * for (CSVRecord record : parser) { * ... * } * </pre> - * + * <p> + * You may also get a List of records: + * </p> + * <pre> + * Reader in = new StringReader("a;b\nc;d"); + * CSVParser parser = new CSVParser(in, CSVFormat.EXCEL); + * List<CSVRecord> list = parser.getRecords(); + * </pre> * <p> * Internal parser state is completely covered by the format and the reader-state. * </p>