Skip to content

Commit

Permalink
doc cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
osiegmar committed Aug 18, 2023
1 parent 5ed415a commit 53db126
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
24 changes: 12 additions & 12 deletions src/main/java/de/siegmar/fastcsv/reader/CsvReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
* <p>
* Example use:
* <pre>{@code
* try (CsvReader csvReader = CsvReader.builder().build(path)) {
* for (CsvRow row : csvReader) {
* try (CsvReader csv = CsvReader.builder().build(file)) {
* for (CsvRow row : csv) {
* ...
* }
* }
Expand Down Expand Up @@ -350,31 +350,31 @@ public CsvReader build(final String data) {
}

/**
* Constructs a new {@link CsvReader} for the specified path using UTF-8 as the character set.
* Constructs a new {@link CsvReader} for the specified file using UTF-8 as the character set.
*
* @param path the file to read data from.
* @param file the file to read data from.
* @return a new CsvReader - never {@code null}. Don't forget to close it!
* @throws IOException if an I/O error occurs.
* @throws NullPointerException if path or charset is {@code null}
* @throws NullPointerException if file or charset is {@code null}
*/
public CsvReader build(final Path path) throws IOException {
return build(path, StandardCharsets.UTF_8);
public CsvReader build(final Path file) throws IOException {
return build(file, StandardCharsets.UTF_8);
}

/**
* Constructs a new {@link CsvReader} for the specified arguments.
*
* @param path the file to read data from.
* @param file the file to read data from.
* @param charset the character set to use.
* @return a new CsvReader - never {@code null}. Don't forget to close it!
* @throws IOException if an I/O error occurs.
* @throws NullPointerException if path or charset is {@code null}
* @throws NullPointerException if file or charset is {@code null}
*/
public CsvReader build(final Path path, final Charset charset) throws IOException {
Objects.requireNonNull(path, "path must not be null");
public CsvReader build(final Path file, final Charset charset) throws IOException {
Objects.requireNonNull(file, "file must not be null");
Objects.requireNonNull(charset, "charset must not be null");

return newReader(new InputStreamReader(Files.newInputStream(path), charset));
return newReader(new InputStreamReader(Files.newInputStream(file), charset));
}

private CsvReader newReader(final Reader reader) {
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/de/siegmar/fastcsv/reader/NamedCsvReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
import java.util.stream.StreamSupport;

/**
* Header name based Csv reader implementation.
* Header name based CSV reader implementation.
* <p>
* Example use:
* <pre>{@code
* try (NamedCsvReader csvReader = NamedCsvReader.builder().build(path)) {
* for (NamedCsvRow row : csvReader) {
* try (NamedCsvReader csv = NamedCsvReader.builder().build(file)) {
* for (NamedCsvRow row : csv) {
* ...
* }
* }
Expand Down Expand Up @@ -215,28 +215,28 @@ public NamedCsvReaderBuilder skipComments(final boolean skipComments) {
}

/**
* Constructs a new {@link NamedCsvReader} for the specified path using UTF-8 as the character set.
* Constructs a new {@link NamedCsvReader} for the specified file using UTF-8 as the character set.
*
* @param path the file to read data from.
* @param file the file to read data from.
* @return a new NamedCsvReader - never {@code null}. Don't forget to close it!
* @throws IOException if an I/O error occurs.
* @throws NullPointerException if path or charset is {@code null}
* @throws NullPointerException if file or charset is {@code null}
*/
public NamedCsvReader build(final Path path) throws IOException {
return build(path, StandardCharsets.UTF_8);
public NamedCsvReader build(final Path file) throws IOException {
return build(file, StandardCharsets.UTF_8);
}

/**
* Constructs a new {@link NamedCsvReader} for the specified arguments.
*
* @param path the file to read data from.
* @param file the file to read data from.
* @param charset the character set to use.
* @return a new NamedCsvReader - never {@code null}. Don't forget to close it!
* @throws IOException if an I/O error occurs.
* @throws NullPointerException if path or charset is {@code null}
* @throws NullPointerException if file or charset is {@code null}
*/
public NamedCsvReader build(final Path path, final Charset charset) throws IOException {
return new NamedCsvReader(csvReaderBuilder().build(path, charset));
public NamedCsvReader build(final Path file, final Charset charset) throws IOException {
return new NamedCsvReader(csvReaderBuilder().build(file, charset));
}

/**
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/de/siegmar/fastcsv/writer/CsvWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* <p>
* Example use:
* <pre>{@code
* try (CsvWriter csv = CsvWriter.builder().build(path)) {
* try (CsvWriter csv = CsvWriter.builder().build(file)) {
* csv.writeRow("Hello", "world");
* }
* }</pre>
Expand Down Expand Up @@ -406,37 +406,37 @@ public CsvWriter build(final Writer writer) {
/**
* Constructs a {@link CsvWriter} for the specified Path.
*
* @param path the path to write data to.
* @param file the file to write data to.
* @param openOptions options specifying how the file is opened.
* See {@link Files#newOutputStream(Path, OpenOption...)} for defaults.
* @return a new CsvWriter instance - never {@code null}. Don't forget to close it!
* @throws IOException if a write error occurs
* @throws NullPointerException if path or charset is {@code null}
* @throws NullPointerException if file or charset is {@code null}
*/
public CsvWriter build(final Path path, final OpenOption... openOptions)
public CsvWriter build(final Path file, final OpenOption... openOptions)
throws IOException {
return build(path, StandardCharsets.UTF_8, openOptions);
return build(file, StandardCharsets.UTF_8, openOptions);
}

/**
* Constructs a {@link CsvWriter} for the specified Path.
*
* @param path the path to write data to.
* @param file the file to write data to.
* @param charset the character set to be used for writing data to the file.
* @param openOptions options specifying how the file is opened.
* See {@link Files#newOutputStream(Path, OpenOption...)} for defaults.
* @return a new CsvWriter instance - never {@code null}. Don't forget to close it!
* @throws IOException if a write error occurs
* @throws NullPointerException if path or charset is {@code null}
* @throws NullPointerException if file or charset is {@code null}
*/
public CsvWriter build(final Path path, final Charset charset,
public CsvWriter build(final Path file, final Charset charset,
final OpenOption... openOptions)
throws IOException {

Objects.requireNonNull(path, "path must not be null");
Objects.requireNonNull(file, "file must not be null");
Objects.requireNonNull(charset, "charset must not be null");

return newWriter(new OutputStreamWriter(Files.newOutputStream(path, openOptions),
return newWriter(new OutputStreamWriter(Files.newOutputStream(file, openOptions),
charset), false);
}

Expand Down

0 comments on commit 53db126

Please sign in to comment.