You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/03/30 03:16:45 UTC

svn commit: r1307201 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java

Author: sebb
Date: Fri Mar 30 01:16:45 2012
New Revision: 1307201

URL: http://svn.apache.org/viewvc?rev=1307201&view=rev
Log:
Javadoc

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java?rev=1307201&r1=1307200&r2=1307201&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java Fri Mar 30 01:16:45 2012
@@ -171,16 +171,24 @@ class CSVLexer extends Lexer {
      * The encapsulator itself might be included in the token using a
      * doubling syntax (as "", '') or using escaping (as in \", \').
      * Whitespaces before and after an encapsulated token are ignored.
+     * The token is finished when one of the following conditions become true:
+     * <ul>
+     *   <li>an unescaped encapsulator has been reached, and is followed by optional whitespace then:</li>
+     *   <ul>
+     *       <li>delimiter (TOKEN)</li>
+     *       <li>end of line (EORECORD)</li>
+     *   </ul>
+     *   <li>end of stream has been reached (EOF)</li>
+     * </ul>
      *
      * @param tkn the current token
      * @return a valid token object
-     * @throws IOException on invalid state
+     * @throws IOException on invalid state: 
+     *  EOF before closing encapsulator or invalid character before delimiter or EOL
      */
     private Token encapsulatedTokenLexer(Token tkn) throws IOException {
-        // save current line
+        // save current line number in case needed for IOE
         int startLineNumber = getLineNumber();
-        // ignore the given delimiter
-        // assert c == delimiter;
         int c;
         while (true) {
             c = in.read();
@@ -204,7 +212,6 @@ class CSVLexer extends Lexer {
                             tkn.isReady = true; // There is data at EOF
                             return tkn;
                         } else if (isEndOfLine(c)) {
-                            // ok eo token reached
                             tkn.type = EORECORD;
                             return tkn;
                         } else if (!isWhitespace(c)) {