Skip to content

Commit d89a0f4

Browse files
committed
Javadoc
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1307201 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5c3e513 commit d89a0f4

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/main/java/org/apache/commons/csv/CSVLexer.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,24 @@ private Token simpleTokenLexer(Token tkn, int c) throws IOException {
171171
* The encapsulator itself might be included in the token using a
172172
* doubling syntax (as "", '') or using escaping (as in \", \').
173173
* Whitespaces before and after an encapsulated token are ignored.
174+
* The token is finished when one of the following conditions become true:
175+
* <ul>
176+
* <li>an unescaped encapsulator has been reached, and is followed by optional whitespace then:</li>
177+
* <ul>
178+
* <li>delimiter (TOKEN)</li>
179+
* <li>end of line (EORECORD)</li>
180+
* </ul>
181+
* <li>end of stream has been reached (EOF)</li>
182+
* </ul>
174183
*
175184
* @param tkn the current token
176185
* @return a valid token object
177-
* @throws IOException on invalid state
186+
* @throws IOException on invalid state:
187+
* EOF before closing encapsulator or invalid character before delimiter or EOL
178188
*/
179189
private Token encapsulatedTokenLexer(Token tkn) throws IOException {
180-
// save current line
190+
// save current line number in case needed for IOE
181191
int startLineNumber = getLineNumber();
182-
// ignore the given delimiter
183-
// assert c == delimiter;
184192
int c;
185193
while (true) {
186194
c = in.read();
@@ -204,7 +212,6 @@ private Token encapsulatedTokenLexer(Token tkn) throws IOException {
204212
tkn.isReady = true; // There is data at EOF
205213
return tkn;
206214
} else if (isEndOfLine(c)) {
207-
// ok eo token reached
208215
tkn.type = EORECORD;
209216
return tkn;
210217
} else if (!isWhitespace(c)) {

0 commit comments

Comments
 (0)