diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java b/src/main/java/org/apache/commons/csv/CSVPrinter.java index 22693544..b801901c 100644 --- a/src/main/java/org/apache/commons/csv/CSVPrinter.java +++ b/src/main/java/org/apache/commons/csv/CSVPrinter.java @@ -341,8 +341,11 @@ public final class CSVPrinter implements Flushable, Closeable { } /** - * Prints a single line of delimiter separated values. The values will be quoted if needed. Quotes and newLine - * characters will be escaped. + * Prints the given values a single record of delimiter separated values followed by the record separator. + * + *
+ * The values will be quoted if needed. Quotes and newLine characters will be escaped. + *
* * @param values * values to output. @@ -357,8 +360,11 @@ public final class CSVPrinter implements Flushable, Closeable { } /** - * Prints a single line of delimiter separated values. The values will be quoted if needed. Quotes and newLine - * characters will be escaped. + * Prints the given values a single record of delimiter separated values followed by the record separator. + * + *+ * The values will be quoted if needed. Quotes and newLine characters will be escaped. + *
* * @param values * values to output. @@ -373,7 +379,30 @@ public final class CSVPrinter implements Flushable, Closeable { } /** - * Prints all the objects in the given collection. + * Prints all the objects in the given collection handling nested collections/arrays as records. + * + *If the given collection only contains simple objects, this method will print a single record like + * {@link #printRecord(Iterable)}. If the given collections contains nested collections/arrays those nested elements + * will each be printed as records using {@link #printRecord(Object...)}.
+ * + *Given the following data structure:
+ *+ * + *+ * + *
Calling this method will print:
+ *+ * + ** * @param values * the values to print. @@ -393,14 +422,37 @@ public final class CSVPrinter implements Flushable, Closeable { } /** - * Prints all the objects in the given array. + * Prints all the objects in the given array handling nested collections/arrays as records. + * + *
If the given array only contains simple objects, this method will print a single record like + * {@link #printRecord(Object...)}. If the given collections contains nested collections/arrays those nested elements + * will each be printed as records using {@link #printRecord(Object...)}.
+ * + *Given the following data structure:
+ *+ * + *+ * + *
Calling this method will print:
+ *+ * + ** * @param values * the values to print. * @throws IOException * If an I/O error occurs */ - public void printRecords(final Object[] values) throws IOException { + public void printRecords(final Object... values) throws IOException { for (final Object value : values) { if (value instanceof Object[]) { this.printRecord((Object[]) value);