@@ -64,15 +64,14 @@ public class CSVParser implements Iterable<String[]> {
6464 /** Immutable empty String array. */
6565 private static final String [] EMPTY_STRING_ARRAY = new String [0 ];
6666
67- // the input stream
67+ /** The input stream */
6868 private final ExtendedBufferedReader in ;
6969
7070 private final CSVFormat format ;
7171
7272 // the following objects are shared to reduce garbage
73- /**
74- * A record buffer for getLine(). Grows as necessary and is reused.
75- */
73+
74+ /** A record buffer for getLine(). Grows as necessary and is reused. */
7675 private final List <String > record = new ArrayList <String >();
7776 private final Token reusableToken = new Token ();
7877 private final CharBuffer wsBuf = new CharBuffer ();
@@ -146,12 +145,10 @@ public CSVParser(Reader input, CSVFormat format) {
146145 // ======================================================
147146
148147 /**
149- * Parses the CSV according to the given format
150- * and returns the content as an array of records
151- * (whereas records are arrays of single values).
148+ * Parses the CSV according to the given format and returns the content
149+ * as an array of records (whereas records are arrays of single values).
152150 * <p/>
153- * The returned content starts at the current parse-position in
154- * the stream.
151+ * The returned content starts at the current parse-position in the stream.
155152 *
156153 * @return matrix of records x values ('null' when end of file)
157154 * @throws IOException on parse error or input read-failure
@@ -171,11 +168,9 @@ public String[][] getRecords() throws IOException {
171168 }
172169
173170 /**
174- * Parses from the current point in the stream til
175- * the end of the current line.
171+ * Parses from the current point in the stream til * the end of the current line.
176172 *
177- * @return array of values til end of line
178- * ('null' when end of file has been reached)
173+ * @return array of values til end of line ('null' when end of file has been reached)
179174 * @throws IOException on parse error or input read-failure
180175 */
181176 String [] getLine () throws IOException {
@@ -209,7 +204,7 @@ String[] getLine() throws IOException {
209204 }
210205 }
211206 if (!record .isEmpty ()) {
212- ret = ( String []) record .toArray (new String [record .size ()]);
207+ ret = record .toArray (new String [record .size ()]);
213208 }
214209 return ret ;
215210 }
@@ -283,11 +278,9 @@ Token nextToken() throws IOException {
283278 /**
284279 * Returns the next token.
285280 * <p/>
286- * A token corresponds to a term, a record change or an
287- * end-of-file indicator.
281+ * A token corresponds to a term, a record change or an end-of-file indicator.
288282 *
289- * @param tkn an existing Token object to reuse. The caller is responsible to initialize the
290- * Token.
283+ * @param tkn an existing Token object to reuse. The caller is responsible to initialize the Token.
291284 * @return the next token found
292285 * @throws IOException on stream access error
293286 */
@@ -380,9 +373,9 @@ Token nextToken(Token tkn) throws IOException {
380373 * A simple token might contain escaped delimiters (as \, or \;). The
381374 * token is finished when one of the following conditions become true:
382375 * <ul>
383- * <li>end of line has been reached (EORECORD)</li>
384- * <li>end of stream has been reached (EOF)</li>
385- * <li>an unescaped delimiter has been reached (TOKEN)</li>
376+ * <li>end of line has been reached (EORECORD)</li>
377+ * <li>end of stream has been reached (EOF)</li>
378+ * <li>an unescaped delimiter has been reached (TOKEN)</li>
386379 * </ul>
387380 *
388381 * @param tkn the current token
@@ -476,19 +469,13 @@ private Token encapsulatedTokenLexer(Token tkn, int c) throws IOException {
476469 return tkn ;
477470 } else if (!isWhitespace (c )) {
478471 // error invalid char between token and next delimiter
479- throw new IOException (
480- "(line " + getLineNumber ()
481- + ") invalid char between encapsulated token end delimiter"
482- );
472+ throw new IOException ("(line " + getLineNumber () + ") invalid char between encapsulated token and delimiter" );
483473 }
484474 }
485475 }
486476 } else if (isEndOfFile (c )) {
487477 // error condition (end of file before end of token)
488- throw new IOException (
489- "(startline " + startLineNumber + ")"
490- + "eof reached before encapsulated token finished"
491- );
478+ throw new IOException ("(startline " + startLineNumber + ") EOF reached before encapsulated token finished" );
492479 } else {
493480 // consume character
494481 tkn .content .append ((char ) c );
@@ -500,8 +487,7 @@ private Token encapsulatedTokenLexer(Token tkn, int c) throws IOException {
500487 /**
501488 * Decodes Unicode escapes.
502489 * <p/>
503- * Interpretation of "\\uXXXX" escape sequences
504- * where XXXX is a hex-number.
490+ * Interpretation of "\\uXXXX" escape sequences where XXXX is a hex-number.
505491 *
506492 * @param c current char which is discarded because it's the "\\" of "\\uXXXX"
507493 * @return the decoded character
@@ -555,10 +541,6 @@ private int readEscape(int c) throws IOException {
555541 return out ;
556542 }
557543
558- // ======================================================
559- // strategies
560- // ======================================================
561-
562544 /**
563545 * Obtain the specified CSV format.
564546 *
0 commit comments