@@ -152,7 +152,7 @@ public static class Builder extends AbstractStreamBuilder<CSVParser, Builder> {
152152
153153 private CSVFormat format ;
154154 private long characterOffset ;
155- private long recordNumber ;
155+ private long recordNumber = 1 ;
156156
157157 /**
158158 * Constructs a new instance.
@@ -190,7 +190,7 @@ public Builder setFormat(final CSVFormat format) {
190190 }
191191
192192 /**
193- * Sets the next record number to assign.
193+ * Sets the next record number to assign, defaults to {@code 1} .
194194 *
195195 * @param recordNumber the next record number to assign.
196196 * @return this instance.
@@ -377,7 +377,7 @@ public static CSVParser parse(final Path path, final Charset charset, final CSVF
377377 * @since 1.5
378378 */
379379 public static CSVParser parse (final Reader reader , final CSVFormat format ) throws IOException {
380- return new CSVParser ( reader , format );
380+ return builder (). setReader ( reader ). setFormat ( format ). get ( );
381381 }
382382
383383 /**
@@ -397,8 +397,7 @@ public static CSVParser parse(final Reader reader, final CSVFormat format) throw
397397 public static CSVParser parse (final String string , final CSVFormat format ) throws IOException {
398398 Objects .requireNonNull (string , "string" );
399399 Objects .requireNonNull (format , "format" );
400-
401- return new CSVParser (new StringReader (string ), format );
400+ return parse (new StringReader (string ), format );
402401 }
403402
404403 /**
@@ -425,10 +424,7 @@ public static CSVParser parse(final String string, final CSVFormat format) throw
425424 @ SuppressWarnings ("resource" )
426425 public static CSVParser parse (final URL url , final Charset charset , final CSVFormat format ) throws IOException {
427426 Objects .requireNonNull (url , "url" );
428- Objects .requireNonNull (charset , "charset" );
429- Objects .requireNonNull (format , "format" );
430-
431- return new CSVParser (new InputStreamReader (url .openStream (), charset ), format );
427+ return parse (url .openStream (), charset , format );
432428 }
433429
434430 private String headerComment ;
0 commit comments