This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-csv.git
The following commit(s) were added to refs/heads/master by this push: new 3916442d Javadoc 3916442d is described below commit 3916442dfeb1c17b1a53630f89b948866cbe6453 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri Mar 14 14:21:29 2025 -0400 Javadoc --- .../java/org/apache/commons/csv/CSVFormat.java | 8 +++---- .../java/org/apache/commons/csv/CSVPrinter.java | 26 ++++++++++------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java index 00a692aa..327083a2 100644 --- a/src/main/java/org/apache/commons/csv/CSVFormat.java +++ b/src/main/java/org/apache/commons/csv/CSVFormat.java @@ -2315,7 +2315,7 @@ public final class CSVFormat implements Serializable { } /* - * Note: Must only be called if escaping is enabled, otherwise can throw exceptions. + * This method must only be called if escaping is enabled, otherwise can throw exceptions. */ private void printWithEscapes(final CharSequence charSeq, final Appendable appendable) throws IOException { int start = 0; @@ -2358,7 +2358,7 @@ public final class CSVFormat implements Serializable { } /* - * Note: Must only be called if escaping is enabled, otherwise can throw exceptions. + * This method must only be called if escaping is enabled, otherwise can throw exceptions. */ private void printWithEscapes(final Reader reader, final Appendable appendable) throws IOException { int start = 0; @@ -2408,9 +2408,9 @@ public final class CSVFormat implements Serializable { } /* - * Note: must only be called if quoting is enabled, otherwise will generate NPE + * This method must only be called if quoting is enabled, otherwise will generate NPE. + * The original object is needed so can check for Number */ - // the original object is needed so can check for Number private void printWithQuotes(final Object object, final CharSequence charSeq, final Appendable out, final boolean newRecord) throws IOException { boolean quote = false; int start = 0; diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java b/src/main/java/org/apache/commons/csv/CSVPrinter.java index 3a8e0370..3b9efa7c 100644 --- a/src/main/java/org/apache/commons/csv/CSVPrinter.java +++ b/src/main/java/org/apache/commons/csv/CSVPrinter.java @@ -91,23 +91,19 @@ public final class CSVPrinter implements Flushable, Closeable { /** * Creates a printer that will print values to the given stream following the CSVFormat. * <p> - * Currently, only a pure encapsulation format or a pure escaping format is supported. Hybrid formats (encapsulation - * and escaping with a different character) are not supported. + * Currently, only a pure encapsulation format or a pure escaping format is supported. Hybrid formats (encapsulation and escaping with a different + * character) are not supported. * </p> * - * @param appendable - * stream to which to print. Must not be null. - * @param format - * the CSV format. Must not be null. - * @throws IOException - * thrown if the optional header cannot be printed. - * @throws IllegalArgumentException - * thrown if the parameters of the format are inconsistent or if either out or format are null. + * @param appendable stream to which to print. Must not be null. + * @param format the CSV format. Must not be null. + * @throws IOException thrown if the optional header cannot be printed. + * @throws IllegalArgumentException thrown if the parameters of the format are inconsistent. + * @throws NullPointerException thrown if either parameters are null. */ public CSVPrinter(final Appendable appendable, final CSVFormat format) throws IOException { Objects.requireNonNull(appendable, "appendable"); Objects.requireNonNull(format, "format"); - this.appendable = appendable; this.format = format.copy(); // TODO: Is it a good idea to do this here instead of on the first call to a print method? @@ -130,10 +126,12 @@ public final class CSVPrinter implements Flushable, Closeable { /** * Closes the underlying stream with an optional flush first. + * * @param flush whether to flush before the actual close. * @throws IOException * If an I/O error occurs * @since 1.6 + * @see CSVFormat#getAutoFlush() */ public void close(final boolean flush) throws IOException { if (flush || format.getAutoFlush()) { @@ -145,7 +143,7 @@ public final class CSVPrinter implements Flushable, Closeable { } /** - * Outputs the record separator and increments the record count. + * Prints the record separator and increments the record count. * * @throws IOException * If an I/O error occurs @@ -174,7 +172,7 @@ public final class CSVPrinter implements Flushable, Closeable { * @return the target Appendable. */ public Appendable getOut() { - return this.appendable; + return appendable; } /** @@ -267,7 +265,7 @@ public final class CSVPrinter implements Flushable, Closeable { } /** - * Outputs the record separator. + * Prints the record separator. * * @throws IOException * If an I/O error occurs