From 497d3cb51a25e2e9683b2ac64324f504cb0b9603 Mon Sep 17 00:00:00 2001 From: Benedikt Ritter Date: Fri, 13 Sep 2013 10:53:33 +0000 Subject: [PATCH] Add documentation about parsing CSV content into memory git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1522861 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/commons/csv/CSVParser.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java b/src/main/java/org/apache/commons/csv/CSVParser.java index 591a4bdc..fc67e5b5 100644 --- a/src/main/java/org/apache/commons/csv/CSVParser.java +++ b/src/main/java/org/apache/commons/csv/CSVParser.java @@ -92,7 +92,7 @@ import java.util.NoSuchElementException; * *

Parsing completely into memory

*

- * You may also get a List of records: + * If parsing record wise is not desired, the contents of the input can be read completely into memory. *

* *
@@ -100,6 +100,20 @@ import java.util.NoSuchElementException;
  * CSVParser parser = new CSVParser(in, CSVFormat.EXCEL);
  * List<CSVRecord> list = parser.getRecords();
  * 
+ * + *

+ * There are two constraints that have to be kept in mind: + *

+ * + *

+ *

    + *
  1. Parsing into memory starts at the current position of the parser. If you have already parsed records from + * the input, those records will not end up in the in memory representation of your CSV data.
  2. + *
  3. Parsing into memory may consume a lot of system resources depending on the input. For example if you're + * parsing a 150MB file of CSV data the contents will be read completely into memory.
  4. + *
+ *

+ * *

* Internal parser state is completely covered by the format and the reader-state. *