@@ -748,6 +748,16 @@ public boolean getAllowMissingColumnNames() {
748748 return allowMissingColumnNames ;
749749 }
750750
751+ /**
752+ * Returns whether to flush on close.
753+ *
754+ * @return whether to flush on close.
755+ * @since 1.6
756+ */
757+ public boolean getAutoFlush () {
758+ return autoFlush ;
759+ }
760+
751761 /**
752762 * Returns the character marking the start of a line comment.
753763 *
@@ -891,16 +901,6 @@ public boolean getTrim() {
891901 return trim ;
892902 }
893903
894- /**
895- * Returns whether to flush on close.
896- *
897- * @return whether to flush on close.
898- * @since 1.6
899- */
900- public boolean getAutoFlush () {
901- return autoFlush ;
902- }
903-
904904 @ Override
905905 public int hashCode () {
906906 final int prime = 31 ;
@@ -993,22 +993,6 @@ public CSVPrinter print(final Appendable out) throws IOException {
993993 return new CSVPrinter (out , this );
994994 }
995995
996- /**
997- * Prints to the {@link System#out}.
998- *
999- * <p>
1000- * See also {@link CSVPrinter}.
1001- * </p>
1002- *
1003- * @return a printer to {@link System#out}.
1004- * @throws IOException
1005- * thrown if the optional header cannot be printed.
1006- * @since 1.5
1007- */
1008- public CSVPrinter printer () throws IOException {
1009- return new CSVPrinter (System .out , this );
1010- }
1011-
1012996 /**
1013997 * Prints to the specified output.
1014998 *
@@ -1031,26 +1015,6 @@ public CSVPrinter print(final File out, final Charset charset) throws IOExceptio
10311015 return new CSVPrinter (new OutputStreamWriter (new FileOutputStream (out ), charset ), this );
10321016 }
10331017
1034- /**
1035- * Prints to the specified output.
1036- *
1037- * <p>
1038- * See also {@link CSVPrinter}.
1039- * </p>
1040- *
1041- * @param out
1042- * the output.
1043- * @param charset
1044- * A charset.
1045- * @return a printer to an output.
1046- * @throws IOException
1047- * thrown if the optional header cannot be printed.
1048- * @since 1.5
1049- */
1050- public CSVPrinter print (final Path out , final Charset charset ) throws IOException {
1051- return print (Files .newBufferedWriter (out , charset ));
1052- }
1053-
10541018 /**
10551019 * Prints the {@code value} as the next value on the line to {@code out}. The value will be escaped or encapsulated
10561020 * as needed. Useful when one wants to avoid creating CSVPrinters.
@@ -1104,6 +1068,26 @@ private void print(final Object object, final CharSequence value, final int offs
11041068 }
11051069 }
11061070
1071+ /**
1072+ * Prints to the specified output.
1073+ *
1074+ * <p>
1075+ * See also {@link CSVPrinter}.
1076+ * </p>
1077+ *
1078+ * @param out
1079+ * the output.
1080+ * @param charset
1081+ * A charset.
1082+ * @return a printer to an output.
1083+ * @throws IOException
1084+ * thrown if the optional header cannot be printed.
1085+ * @since 1.5
1086+ */
1087+ public CSVPrinter print (final Path out , final Charset charset ) throws IOException {
1088+ return print (Files .newBufferedWriter (out , charset ));
1089+ }
1090+
11071091 /*
11081092 * Note: must only be called if escaping is enabled, otherwise will generate NPE
11091093 */
@@ -1253,6 +1237,22 @@ private void printAndQuote(final Object object, final CharSequence value, final
12531237 out .append (quoteChar );
12541238 }
12551239
1240+ /**
1241+ * Prints to the {@link System#out}.
1242+ *
1243+ * <p>
1244+ * See also {@link CSVPrinter}.
1245+ * </p>
1246+ *
1247+ * @return a printer to {@link System#out}.
1248+ * @throws IOException
1249+ * thrown if the optional header cannot be printed.
1250+ * @since 1.5
1251+ */
1252+ public CSVPrinter printer () throws IOException {
1253+ return new CSVPrinter (System .out , this );
1254+ }
1255+
12561256 /**
12571257 * Outputs the trailing delimiter (if set) followed by the record separator (if set).
12581258 *
@@ -1445,6 +1445,21 @@ public CSVFormat withAllowMissingColumnNames(final boolean allowMissingColumnNam
14451445 skipHeaderRecord , allowMissingColumnNames , ignoreHeaderCase , trim , trailingDelimiter , autoFlush );
14461446 }
14471447
1448+ /**
1449+ * Returns a new {@code CSVFormat} with whether to flush on close.
1450+ *
1451+ * @param autoFlush
1452+ * whether to flush on close.
1453+ *
1454+ * @return A new CSVFormat that is equal to this but with the specified autoFlush setting.
1455+ * @since 1.6
1456+ */
1457+ public CSVFormat withAutoFlush (final boolean autoFlush ) {
1458+ return new CSVFormat (delimiter , quoteCharacter , quoteMode , commentMarker , escapeCharacter ,
1459+ ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , headerComments , header ,
1460+ skipHeaderRecord , allowMissingColumnNames , ignoreHeaderCase , trim , trailingDelimiter , autoFlush );
1461+ }
1462+
14481463 /**
14491464 * Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
14501465 *
@@ -1959,19 +1974,4 @@ public CSVFormat withTrim(final boolean trim) {
19591974 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , headerComments , header ,
19601975 skipHeaderRecord , allowMissingColumnNames , ignoreHeaderCase , trim , trailingDelimiter , autoFlush );
19611976 }
1962-
1963- /**
1964- * Returns a new {@code CSVFormat} with whether to flush on close.
1965- *
1966- * @param autoFlush
1967- * whether to flush on close.
1968- *
1969- * @return A new CSVFormat that is equal to this but with the specified autoFlush setting.
1970- * @since 1.6
1971- */
1972- public CSVFormat withAutoFlush (final boolean autoFlush ) {
1973- return new CSVFormat (delimiter , quoteCharacter , quoteMode , commentMarker , escapeCharacter ,
1974- ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , headerComments , header ,
1975- skipHeaderRecord , allowMissingColumnNames , ignoreHeaderCase , trim , trailingDelimiter , autoFlush );
1976- }
19771977}
0 commit comments