You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@commons.apache.org by br...@apache.org on 2018/09/25 13:16:04 UTC

svn commit: r1035683 [15/32] - in /websites/production/commons/content/proper/commons-csv: ./ apidocs/ apidocs/org/apache/commons/csv/ apidocs/org/apache/commons/csv/class-use/ apidocs/src-html/org/apache/commons/csv/ jacoco-aggregate/ jacoco-aggregate...

Modified: websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVFormat.java.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVFormat.java.html (original)
+++ websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVFormat.java.html Tue Sep 25 13:16:01 2018
@@ -58,8 +58,13 @@ import java.util.Set;
  * <ul>
  * <li>{@link #DEFAULT}</li>
  * <li>{@link #EXCEL}</li>
+ * <li>{@link #INFORMIX_UNLOAD}</li>
+ * <li>{@link #INFORMIX_UNLOAD_CSV}</li>
  * <li>{@link #MYSQL}</li>
  * <li>{@link #RFC4180}</li>
+ * <li>{@link #ORACLE}</li>
+ * <li>{@link #POSTGRESQL_CSV}</li>
+ * <li>{@link #POSTGRESQL_TEXT}</li>
  * <li>{@link #TDF}</li>
  * </ul>
  *
@@ -160,61 +165,66 @@ public final class CSVFormat implements
      *
      * @since 1.2
      */
-<span class="fc" id="L163">    public enum Predefined {</span>
+<span class="fc" id="L168">    public enum Predefined {</span>
 
         /**
          * @see CSVFormat#DEFAULT
          */
-<span class="fc" id="L168">        Default(CSVFormat.DEFAULT),</span>
+<span class="fc" id="L173">        Default(CSVFormat.DEFAULT),</span>
 
         /**
          * @see CSVFormat#EXCEL
          */
-<span class="fc" id="L173">        Excel(CSVFormat.EXCEL),</span>
+<span class="fc" id="L178">        Excel(CSVFormat.EXCEL),</span>
 
         /**
          * @see CSVFormat#INFORMIX_UNLOAD
          * @since 1.3
          */
-<span class="fc" id="L179">        InformixUnload(CSVFormat.INFORMIX_UNLOAD),</span>
+<span class="fc" id="L184">        InformixUnload(CSVFormat.INFORMIX_UNLOAD),</span>
 
         /**
          * @see CSVFormat#INFORMIX_UNLOAD_CSV
          * @since 1.3
          */
-<span class="fc" id="L185">        InformixUnloadCsv(CSVFormat.INFORMIX_UNLOAD_CSV),</span>
+<span class="fc" id="L190">        InformixUnloadCsv(CSVFormat.INFORMIX_UNLOAD_CSV),</span>
 
         /**
          * @see CSVFormat#MYSQL
          */
-<span class="fc" id="L190">        MySQL(CSVFormat.MYSQL),</span>
+<span class="fc" id="L195">        MySQL(CSVFormat.MYSQL),</span>
+
+        /**
+         * @see CSVFormat#ORACLE
+         */
+<span class="fc" id="L200">        Oracle(CSVFormat.ORACLE),</span>
 
         /**
          * @see CSVFormat#POSTGRESQL_CSV
          * @since 1.5
          */
-<span class="fc" id="L196">        PostgreSQLCsv(CSVFormat.POSTGRESQL_CSV),</span>
+<span class="fc" id="L206">        PostgreSQLCsv(CSVFormat.POSTGRESQL_CSV),</span>
 
         /**
          * @see CSVFormat#POSTGRESQL_CSV
          */
-<span class="fc" id="L201">        PostgreSQLText(CSVFormat.POSTGRESQL_TEXT),</span>
+<span class="fc" id="L211">        PostgreSQLText(CSVFormat.POSTGRESQL_TEXT),</span>
 
         /**
          * @see CSVFormat#RFC4180
          */
-<span class="fc" id="L206">        RFC4180(CSVFormat.RFC4180),</span>
+<span class="fc" id="L216">        RFC4180(CSVFormat.RFC4180),</span>
 
         /**
          * @see CSVFormat#TDF
          */
-<span class="fc" id="L211">        TDF(CSVFormat.TDF);</span>
+<span class="fc" id="L221">        TDF(CSVFormat.TDF);</span>
 
         private final CSVFormat format;
 
-<span class="fc" id="L215">        Predefined(final CSVFormat format) {</span>
-<span class="fc" id="L216">            this.format = format;</span>
-<span class="fc" id="L217">        }</span>
+<span class="fc" id="L225">        Predefined(final CSVFormat format) {</span>
+<span class="fc" id="L226">            this.format = format;</span>
+<span class="fc" id="L227">        }</span>
 
         /**
          * Gets the format.
@@ -222,12 +232,12 @@ public final class CSVFormat implements
          * @return the format.
          */
         public CSVFormat getFormat() {
-<span class="fc" id="L225">            return format;</span>
+<span class="fc" id="L235">            return format;</span>
         }
     }
 
     /**
-     * Standard comma separated format, as for {@link #RFC4180} but allowing empty lines.
+     * Standard Comma Separated Value format, as for {@link #RFC4180} but allowing empty lines.
      *
      * &lt;p&gt;
      * Settings are:
@@ -241,8 +251,8 @@ public final class CSVFormat implements
      *
      * @see Predefined#Default
      */
-<span class="fc" id="L244">    public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true, CRLF,</span>
-            null, null, null, false, false, false, false, false);
+<span class="fc" id="L254">    public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true, CRLF,</span>
+            null, null, null, false, false, false, false, false, false);
 
     /**
      * Excel file format (using a comma as the value delimiter). Note that the actual value delimiter used by Excel is
@@ -267,16 +277,16 @@ public final class CSVFormat implements
      * &lt;li&gt;{@link #withAllowMissingColumnNames(boolean) withAllowMissingColumnNames(true)}&lt;/li&gt;
      * &lt;/ul&gt;
      * &lt;p&gt;
-     * Note: this is currently like {@link #RFC4180} plus {@link #withAllowMissingColumnNames(boolean)
-     * withAllowMissingColumnNames(true)}.
+     * Note: This is currently like {@link #RFC4180} plus {@link #withAllowMissingColumnNames(boolean)
+     * withAllowMissingColumnNames(true)} and {@link #withIgnoreEmptyLines(boolean) withIgnoreEmptyLines(false)}.
      * &lt;/p&gt;
      *
      * @see Predefined#Excel
      */
     // @formatter:off
-<span class="fc" id="L277">    public static final CSVFormat EXCEL = DEFAULT</span>
-<span class="fc" id="L278">            .withIgnoreEmptyLines(false)</span>
-<span class="fc" id="L279">            .withAllowMissingColumnNames();</span>
+<span class="fc" id="L287">    public static final CSVFormat EXCEL = DEFAULT</span>
+<span class="fc" id="L288">            .withIgnoreEmptyLines(false)</span>
+<span class="fc" id="L289">            .withAllowMissingColumnNames();</span>
     // @formatter:on
 
     /**
@@ -304,11 +314,11 @@ public final class CSVFormat implements
      * @since 1.3
      */
     // @formatter:off
-<span class="fc" id="L307">    public static final CSVFormat INFORMIX_UNLOAD = DEFAULT</span>
-<span class="fc" id="L308">            .withDelimiter(PIPE)</span>
-<span class="fc" id="L309">            .withEscape(BACKSLASH)</span>
-<span class="fc" id="L310">            .withQuote(DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L311">            .withRecordSeparator(LF);</span>
+<span class="fc" id="L317">    public static final CSVFormat INFORMIX_UNLOAD = DEFAULT</span>
+<span class="fc" id="L318">            .withDelimiter(PIPE)</span>
+<span class="fc" id="L319">            .withEscape(BACKSLASH)</span>
+<span class="fc" id="L320">            .withQuote(DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L321">            .withRecordSeparator(LF);</span>
     // @formatter:on
 
     /**
@@ -335,10 +345,10 @@ public final class CSVFormat implements
      * @since 1.3
      */
     // @formatter:off
-<span class="fc" id="L338">    public static final CSVFormat INFORMIX_UNLOAD_CSV = DEFAULT</span>
-<span class="fc" id="L339">            .withDelimiter(COMMA)</span>
-<span class="fc" id="L340">            .withQuote(DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L341">            .withRecordSeparator(LF);</span>
+<span class="fc" id="L348">    public static final CSVFormat INFORMIX_UNLOAD_CSV = DEFAULT</span>
+<span class="fc" id="L349">            .withDelimiter(COMMA)</span>
+<span class="fc" id="L350">            .withQuote(DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L351">            .withRecordSeparator(LF);</span>
     // @formatter:on
 
     /**
@@ -367,14 +377,53 @@ public final class CSVFormat implements
      *      -data.html&lt;/a&gt;
      */
     // @formatter:off
-<span class="fc" id="L370">    public static final CSVFormat MYSQL = DEFAULT</span>
-<span class="fc" id="L371">            .withDelimiter(TAB)</span>
-<span class="fc" id="L372">            .withEscape(BACKSLASH)</span>
-<span class="fc" id="L373">            .withIgnoreEmptyLines(false)</span>
-<span class="fc" id="L374">            .withQuote(null)</span>
-<span class="fc" id="L375">            .withRecordSeparator(LF)</span>
-<span class="fc" id="L376">            .withNullString(&quot;\\N&quot;)</span>
-<span class="fc" id="L377">            .withQuoteMode(QuoteMode.ALL_NON_NULL);</span>
+<span class="fc" id="L380">    public static final CSVFormat MYSQL = DEFAULT</span>
+<span class="fc" id="L381">            .withDelimiter(TAB)</span>
+<span class="fc" id="L382">            .withEscape(BACKSLASH)</span>
+<span class="fc" id="L383">            .withIgnoreEmptyLines(false)</span>
+<span class="fc" id="L384">            .withQuote(null)</span>
+<span class="fc" id="L385">            .withRecordSeparator(LF)</span>
+<span class="fc" id="L386">            .withNullString(&quot;\\N&quot;)</span>
+<span class="fc" id="L387">            .withQuoteMode(QuoteMode.ALL_NON_NULL);</span>
+    // @formatter:off
+
+    /**
+     * Default Oracle format used by the SQL*Loader utility.
+     *
+     * &lt;p&gt;
+     * This is a comma-delimited format with the system line separator character as the record separator.Values are
+     * double quoted when needed and special characters are escaped with {@code '&quot;'}. The default NULL string is
+     * {@code &quot;&quot;}. Values are trimmed.
+     * &lt;/p&gt;
+     *
+     * &lt;p&gt;
+     * Settings are:
+     * &lt;/p&gt;
+     * &lt;ul&gt;
+     * &lt;li&gt;withDelimiter(',') // default is {@code FIELDS TERMINATED BY ','}&lt;/li&gt;
+     * &lt;li&gt;withQuote('&quot;')  // default is {@code OPTIONALLY ENCLOSED BY '&quot;'}&lt;/li&gt;
+     * &lt;li&gt;withSystemRecordSeparator()&lt;/li&gt;
+     * &lt;li&gt;withTrim()&lt;/li&gt;
+     * &lt;li&gt;withIgnoreEmptyLines(false)&lt;/li&gt;
+     * &lt;li&gt;withEscape('\\')&lt;/li&gt;
+     * &lt;li&gt;withNullString(&quot;\\N&quot;)&lt;/li&gt;
+     * &lt;li&gt;withQuoteMode(QuoteMode.MINIMAL)&lt;/li&gt;
+     * &lt;/ul&gt;
+     *
+     * @see Predefined#Oracle
+     * @see &lt;a href=&quot;https://s.apache.org/CGXG&quot;&gt;Oracle CSV Format Specification&lt;/a&gt;
+     * @since 1.6
+     */
+    // @formatter:off
+<span class="fc" id="L418">    public static final CSVFormat ORACLE = DEFAULT</span>
+<span class="fc" id="L419">            .withDelimiter(COMMA)</span>
+<span class="fc" id="L420">            .withEscape(BACKSLASH)</span>
+<span class="fc" id="L421">            .withIgnoreEmptyLines(false)</span>
+<span class="fc" id="L422">            .withQuote(DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L423">            .withNullString(&quot;\\N&quot;)</span>
+<span class="fc" id="L424">            .withTrim()</span>
+<span class="fc" id="L425">            .withSystemRecordSeparator()</span>
+<span class="fc" id="L426">            .withQuoteMode(QuoteMode.MINIMAL);</span>
     // @formatter:off
 
     /**
@@ -399,19 +448,19 @@ public final class CSVFormat implements
      * &lt;/ul&gt;
      *
      * @see Predefined#MySQL
-     * @see &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.1/en/load-data.html&quot;&gt; http://dev.mysql.com/doc/refman/5.1/en/load
-     *      -data.html&lt;/a&gt;
+     * @see &lt;a href=&quot;https://www.postgresql.org/docs/current/static/sql-copy.html&quot;&gt;PostgreSQL COPY command
+     *          documentation&lt;/a&gt;
      * @since 1.5
      */
     // @formatter:off
-<span class="fc" id="L407">    public static final CSVFormat POSTGRESQL_CSV = DEFAULT</span>
-<span class="fc" id="L408">            .withDelimiter(COMMA)</span>
-<span class="fc" id="L409">            .withEscape(DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L410">            .withIgnoreEmptyLines(false)</span>
-<span class="fc" id="L411">            .withQuote(DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L412">            .withRecordSeparator(LF)</span>
-<span class="fc" id="L413">            .withNullString(EMPTY)</span>
-<span class="fc" id="L414">            .withQuoteMode(QuoteMode.ALL_NON_NULL);</span>
+<span class="fc" id="L456">    public static final CSVFormat POSTGRESQL_CSV = DEFAULT</span>
+<span class="fc" id="L457">            .withDelimiter(COMMA)</span>
+<span class="fc" id="L458">            .withEscape(DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L459">            .withIgnoreEmptyLines(false)</span>
+<span class="fc" id="L460">            .withQuote(DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L461">            .withRecordSeparator(LF)</span>
+<span class="fc" id="L462">            .withNullString(EMPTY)</span>
+<span class="fc" id="L463">            .withQuoteMode(QuoteMode.ALL_NON_NULL);</span>
     // @formatter:off
 
     /**
@@ -436,19 +485,19 @@ public final class CSVFormat implements
      * &lt;/ul&gt;
      *
      * @see Predefined#MySQL
-     * @see &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.1/en/load-data.html&quot;&gt; http://dev.mysql.com/doc/refman/5.1/en/load
-     *      -data.html&lt;/a&gt;
+     * @see &lt;a href=&quot;https://www.postgresql.org/docs/current/static/sql-copy.html&quot;&gt;PostgreSQL COPY command
+     *          documentation&lt;/a&gt;
      * @since 1.5
      */
     // @formatter:off
-<span class="fc" id="L444">    public static final CSVFormat POSTGRESQL_TEXT = DEFAULT</span>
-<span class="fc" id="L445">            .withDelimiter(TAB)</span>
-<span class="fc" id="L446">            .withEscape(DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L447">            .withIgnoreEmptyLines(false)</span>
-<span class="fc" id="L448">            .withQuote(DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L449">            .withRecordSeparator(LF)</span>
-<span class="fc" id="L450">            .withNullString(&quot;\\N&quot;)</span>
-<span class="fc" id="L451">            .withQuoteMode(QuoteMode.ALL_NON_NULL);</span>
+<span class="fc" id="L493">    public static final CSVFormat POSTGRESQL_TEXT = DEFAULT</span>
+<span class="fc" id="L494">            .withDelimiter(TAB)</span>
+<span class="fc" id="L495">            .withEscape(DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L496">            .withIgnoreEmptyLines(false)</span>
+<span class="fc" id="L497">            .withQuote(DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L498">            .withRecordSeparator(LF)</span>
+<span class="fc" id="L499">            .withNullString(&quot;\\N&quot;)</span>
+<span class="fc" id="L500">            .withQuoteMode(QuoteMode.ALL_NON_NULL);</span>
     // @formatter:off
 
     /**
@@ -466,7 +515,7 @@ public final class CSVFormat implements
      *
      * @see Predefined#RFC4180
      */
-<span class="fc" id="L469">    public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false);</span>
+<span class="fc" id="L518">    public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false);</span>
 
     private static final long serialVersionUID = 1L;
 
@@ -486,9 +535,9 @@ public final class CSVFormat implements
      * @see Predefined#TDF
      */
     // @formatter:off
-<span class="fc" id="L489">    public static final CSVFormat TDF = DEFAULT</span>
-<span class="fc" id="L490">            .withDelimiter(TAB)</span>
-<span class="fc" id="L491">            .withIgnoreSurroundingSpaces();</span>
+<span class="fc" id="L538">    public static final CSVFormat TDF = DEFAULT</span>
+<span class="fc" id="L539">            .withDelimiter(TAB)</span>
+<span class="fc" id="L540">            .withIgnoreSurroundingSpaces();</span>
     // @formatter:on
 
     /**
@@ -500,7 +549,7 @@ public final class CSVFormat implements
      * @return true if &lt;code&gt;c&lt;/code&gt; is a line break character
      */
     private static boolean isLineBreak(final char c) {
-<span class="fc bfc" id="L503" title="All 4 branches covered.">        return c == LF || c == CR;</span>
+<span class="fc bfc" id="L552" title="All 4 branches covered.">        return c == LF || c == CR;</span>
     }
 
     /**
@@ -512,7 +561,7 @@ public final class CSVFormat implements
      * @return true if &lt;code&gt;c&lt;/code&gt; is a line break character (and not null)
      */
     private static boolean isLineBreak(final Character c) {
-<span class="fc bfc" id="L515" title="All 4 branches covered.">        return c != null &amp;&amp; isLineBreak(c.charValue());</span>
+<span class="fc bfc" id="L564" title="All 4 branches covered.">        return c != null &amp;&amp; isLineBreak(c.charValue());</span>
     }
 
     /**
@@ -536,8 +585,8 @@ public final class CSVFormat implements
      * @see #TDF
      */
     public static CSVFormat newFormat(final char delimiter) {
-<span class="fc" id="L539">        return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false,</span>
-                false, false, false);
+<span class="fc" id="L588">        return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false,</span>
+                false, false, false, false);
     }
 
     /**
@@ -549,7 +598,7 @@ public final class CSVFormat implements
      * @since 1.2
      */
     public static CSVFormat valueOf(final String format) {
-<span class="fc" id="L552">        return CSVFormat.Predefined.valueOf(format).getFormat();</span>
+<span class="fc" id="L601">        return CSVFormat.Predefined.valueOf(format).getFormat();</span>
     }
 
     private final boolean allowMissingColumnNames;
@@ -584,6 +633,8 @@ public final class CSVFormat implements
 
     private final boolean trim;
 
+    private final boolean autoFlush;
+
     /**
      * Creates a customized CSV format.
      *
@@ -619,101 +670,103 @@ public final class CSVFormat implements
      *            TODO
      * @param trailingDelimiter
      *            TODO
+     * @param autoFlush
      * @throws IllegalArgumentException
      *             if the delimiter is a line break character
      */
     private CSVFormat(final char delimiter, final Character quoteChar, final QuoteMode quoteMode,
-            final Character commentStart, final Character escape, final boolean ignoreSurroundingSpaces,
-            final boolean ignoreEmptyLines, final String recordSeparator, final String nullString,
-            final Object[] headerComments, final String[] header, final boolean skipHeaderRecord,
-            final boolean allowMissingColumnNames, final boolean ignoreHeaderCase, final boolean trim,
-<span class="fc" id="L630">            final boolean trailingDelimiter) {</span>
-<span class="fc" id="L631">        this.delimiter = delimiter;</span>
-<span class="fc" id="L632">        this.quoteCharacter = quoteChar;</span>
-<span class="fc" id="L633">        this.quoteMode = quoteMode;</span>
-<span class="fc" id="L634">        this.commentMarker = commentStart;</span>
-<span class="fc" id="L635">        this.escapeCharacter = escape;</span>
-<span class="fc" id="L636">        this.ignoreSurroundingSpaces = ignoreSurroundingSpaces;</span>
-<span class="fc" id="L637">        this.allowMissingColumnNames = allowMissingColumnNames;</span>
-<span class="fc" id="L638">        this.ignoreEmptyLines = ignoreEmptyLines;</span>
-<span class="fc" id="L639">        this.recordSeparator = recordSeparator;</span>
-<span class="fc" id="L640">        this.nullString = nullString;</span>
-<span class="fc" id="L641">        this.headerComments = toStringArray(headerComments);</span>
-<span class="fc bfc" id="L642" title="All 2 branches covered.">        this.header = header == null ? null : header.clone();</span>
-<span class="fc" id="L643">        this.skipHeaderRecord = skipHeaderRecord;</span>
-<span class="fc" id="L644">        this.ignoreHeaderCase = ignoreHeaderCase;</span>
-<span class="fc" id="L645">        this.trailingDelimiter = trailingDelimiter;</span>
-<span class="fc" id="L646">        this.trim = trim;</span>
-<span class="fc" id="L647">        validate();</span>
-<span class="fc" id="L648">    }</span>
+                      final Character commentStart, final Character escape, final boolean ignoreSurroundingSpaces,
+                      final boolean ignoreEmptyLines, final String recordSeparator, final String nullString,
+                      final Object[] headerComments, final String[] header, final boolean skipHeaderRecord,
+                      final boolean allowMissingColumnNames, final boolean ignoreHeaderCase, final boolean trim,
+<span class="fc" id="L682">                      final boolean trailingDelimiter, final boolean autoFlush) {</span>
+<span class="fc" id="L683">        this.delimiter = delimiter;</span>
+<span class="fc" id="L684">        this.quoteCharacter = quoteChar;</span>
+<span class="fc" id="L685">        this.quoteMode = quoteMode;</span>
+<span class="fc" id="L686">        this.commentMarker = commentStart;</span>
+<span class="fc" id="L687">        this.escapeCharacter = escape;</span>
+<span class="fc" id="L688">        this.ignoreSurroundingSpaces = ignoreSurroundingSpaces;</span>
+<span class="fc" id="L689">        this.allowMissingColumnNames = allowMissingColumnNames;</span>
+<span class="fc" id="L690">        this.ignoreEmptyLines = ignoreEmptyLines;</span>
+<span class="fc" id="L691">        this.recordSeparator = recordSeparator;</span>
+<span class="fc" id="L692">        this.nullString = nullString;</span>
+<span class="fc" id="L693">        this.headerComments = toStringArray(headerComments);</span>
+<span class="fc bfc" id="L694" title="All 2 branches covered.">        this.header = header == null ? null : header.clone();</span>
+<span class="fc" id="L695">        this.skipHeaderRecord = skipHeaderRecord;</span>
+<span class="fc" id="L696">        this.ignoreHeaderCase = ignoreHeaderCase;</span>
+<span class="fc" id="L697">        this.trailingDelimiter = trailingDelimiter;</span>
+<span class="fc" id="L698">        this.trim = trim;</span>
+<span class="fc" id="L699">        this.autoFlush = autoFlush;</span>
+<span class="fc" id="L700">        validate();</span>
+<span class="fc" id="L701">    }</span>
 
     @Override
     public boolean equals(final Object obj) {
-<span class="fc bfc" id="L652" title="All 2 branches covered.">        if (this == obj) {</span>
-<span class="fc" id="L653">            return true;</span>
+<span class="fc bfc" id="L705" title="All 2 branches covered.">        if (this == obj) {</span>
+<span class="fc" id="L706">            return true;</span>
         }
-<span class="fc bfc" id="L655" title="All 2 branches covered.">        if (obj == null) {</span>
-<span class="fc" id="L656">            return false;</span>
+<span class="fc bfc" id="L708" title="All 2 branches covered.">        if (obj == null) {</span>
+<span class="fc" id="L709">            return false;</span>
         }
-<span class="fc bfc" id="L658" title="All 2 branches covered.">        if (getClass() != obj.getClass()) {</span>
-<span class="fc" id="L659">            return false;</span>
+<span class="fc bfc" id="L711" title="All 2 branches covered.">        if (getClass() != obj.getClass()) {</span>
+<span class="fc" id="L712">            return false;</span>
         }
 
-<span class="fc" id="L662">        final CSVFormat other = (CSVFormat) obj;</span>
-<span class="fc bfc" id="L663" title="All 2 branches covered.">        if (delimiter != other.delimiter) {</span>
-<span class="fc" id="L664">            return false;</span>
+<span class="fc" id="L715">        final CSVFormat other = (CSVFormat) obj;</span>
+<span class="fc bfc" id="L716" title="All 2 branches covered.">        if (delimiter != other.delimiter) {</span>
+<span class="fc" id="L717">            return false;</span>
         }
-<span class="fc bfc" id="L666" title="All 2 branches covered.">        if (quoteMode != other.quoteMode) {</span>
-<span class="fc" id="L667">            return false;</span>
+<span class="fc bfc" id="L719" title="All 2 branches covered.">        if (quoteMode != other.quoteMode) {</span>
+<span class="fc" id="L720">            return false;</span>
         }
-<span class="fc bfc" id="L669" title="All 2 branches covered.">        if (quoteCharacter == null) {</span>
-<span class="fc bfc" id="L670" title="All 2 branches covered.">            if (other.quoteCharacter != null) {</span>
-<span class="fc" id="L671">                return false;</span>
+<span class="fc bfc" id="L722" title="All 2 branches covered.">        if (quoteCharacter == null) {</span>
+<span class="fc bfc" id="L723" title="All 2 branches covered.">            if (other.quoteCharacter != null) {</span>
+<span class="fc" id="L724">                return false;</span>
             }
-<span class="fc bfc" id="L673" title="All 2 branches covered.">        } else if (!quoteCharacter.equals(other.quoteCharacter)) {</span>
-<span class="fc" id="L674">            return false;</span>
+<span class="fc bfc" id="L726" title="All 2 branches covered.">        } else if (!quoteCharacter.equals(other.quoteCharacter)) {</span>
+<span class="fc" id="L727">            return false;</span>
         }
-<span class="fc bfc" id="L676" title="All 2 branches covered.">        if (commentMarker == null) {</span>
-<span class="fc bfc" id="L677" title="All 2 branches covered.">            if (other.commentMarker != null) {</span>
-<span class="fc" id="L678">                return false;</span>
+<span class="fc bfc" id="L729" title="All 2 branches covered.">        if (commentMarker == null) {</span>
+<span class="fc bfc" id="L730" title="All 2 branches covered.">            if (other.commentMarker != null) {</span>
+<span class="fc" id="L731">                return false;</span>
             }
-<span class="fc bfc" id="L680" title="All 2 branches covered.">        } else if (!commentMarker.equals(other.commentMarker)) {</span>
-<span class="fc" id="L681">            return false;</span>
+<span class="fc bfc" id="L733" title="All 2 branches covered.">        } else if (!commentMarker.equals(other.commentMarker)) {</span>
+<span class="fc" id="L734">            return false;</span>
         }
-<span class="fc bfc" id="L683" title="All 2 branches covered.">        if (escapeCharacter == null) {</span>
-<span class="pc bpc" id="L684" title="1 of 2 branches missed.">            if (other.escapeCharacter != null) {</span>
-<span class="nc" id="L685">                return false;</span>
+<span class="fc bfc" id="L736" title="All 2 branches covered.">        if (escapeCharacter == null) {</span>
+<span class="pc bpc" id="L737" title="1 of 2 branches missed.">            if (other.escapeCharacter != null) {</span>
+<span class="nc" id="L738">                return false;</span>
             }
-<span class="fc bfc" id="L687" title="All 2 branches covered.">        } else if (!escapeCharacter.equals(other.escapeCharacter)) {</span>
-<span class="fc" id="L688">            return false;</span>
+<span class="fc bfc" id="L740" title="All 2 branches covered.">        } else if (!escapeCharacter.equals(other.escapeCharacter)) {</span>
+<span class="fc" id="L741">            return false;</span>
         }
-<span class="fc bfc" id="L690" title="All 2 branches covered.">        if (nullString == null) {</span>
-<span class="pc bpc" id="L691" title="1 of 2 branches missed.">            if (other.nullString != null) {</span>
-<span class="nc" id="L692">                return false;</span>
+<span class="fc bfc" id="L743" title="All 2 branches covered.">        if (nullString == null) {</span>
+<span class="pc bpc" id="L744" title="1 of 2 branches missed.">            if (other.nullString != null) {</span>
+<span class="nc" id="L745">                return false;</span>
             }
-<span class="fc bfc" id="L694" title="All 2 branches covered.">        } else if (!nullString.equals(other.nullString)) {</span>
-<span class="fc" id="L695">            return false;</span>
+<span class="fc bfc" id="L747" title="All 2 branches covered.">        } else if (!nullString.equals(other.nullString)) {</span>
+<span class="fc" id="L748">            return false;</span>
         }
-<span class="fc bfc" id="L697" title="All 2 branches covered.">        if (!Arrays.equals(header, other.header)) {</span>
-<span class="fc" id="L698">            return false;</span>
+<span class="fc bfc" id="L750" title="All 2 branches covered.">        if (!Arrays.equals(header, other.header)) {</span>
+<span class="fc" id="L751">            return false;</span>
         }
-<span class="fc bfc" id="L700" title="All 2 branches covered.">        if (ignoreSurroundingSpaces != other.ignoreSurroundingSpaces) {</span>
-<span class="fc" id="L701">            return false;</span>
+<span class="fc bfc" id="L753" title="All 2 branches covered.">        if (ignoreSurroundingSpaces != other.ignoreSurroundingSpaces) {</span>
+<span class="fc" id="L754">            return false;</span>
         }
-<span class="fc bfc" id="L703" title="All 2 branches covered.">        if (ignoreEmptyLines != other.ignoreEmptyLines) {</span>
-<span class="fc" id="L704">            return false;</span>
+<span class="fc bfc" id="L756" title="All 2 branches covered.">        if (ignoreEmptyLines != other.ignoreEmptyLines) {</span>
+<span class="fc" id="L757">            return false;</span>
         }
-<span class="fc bfc" id="L706" title="All 2 branches covered.">        if (skipHeaderRecord != other.skipHeaderRecord) {</span>
-<span class="fc" id="L707">            return false;</span>
+<span class="fc bfc" id="L759" title="All 2 branches covered.">        if (skipHeaderRecord != other.skipHeaderRecord) {</span>
+<span class="fc" id="L760">            return false;</span>
         }
-<span class="fc bfc" id="L709" title="All 2 branches covered.">        if (recordSeparator == null) {</span>
-<span class="pc bpc" id="L710" title="1 of 2 branches missed.">            if (other.recordSeparator != null) {</span>
-<span class="nc" id="L711">                return false;</span>
+<span class="fc bfc" id="L762" title="All 2 branches covered.">        if (recordSeparator == null) {</span>
+<span class="pc bpc" id="L763" title="1 of 2 branches missed.">            if (other.recordSeparator != null) {</span>
+<span class="nc" id="L764">                return false;</span>
             }
-<span class="fc bfc" id="L713" title="All 2 branches covered.">        } else if (!recordSeparator.equals(other.recordSeparator)) {</span>
-<span class="fc" id="L714">            return false;</span>
+<span class="fc bfc" id="L766" title="All 2 branches covered.">        } else if (!recordSeparator.equals(other.recordSeparator)) {</span>
+<span class="fc" id="L767">            return false;</span>
         }
-<span class="fc" id="L716">        return true;</span>
+<span class="fc" id="L769">        return true;</span>
     }
 
     /**
@@ -724,13 +777,13 @@ public final class CSVFormat implements
      * @return the formatted values
      */
     public String format(final Object... values) {
-<span class="fc" id="L727">        final StringWriter out = new StringWriter();</span>
-<span class="fc" id="L728">        try (final CSVPrinter csvPrinter = new CSVPrinter(out, this)) {</span>
-<span class="fc" id="L729">            csvPrinter.printRecord(values);</span>
-<span class="fc" id="L730">            return out.toString().trim();</span>
-<span class="pc bpc" id="L731" title="4 of 8 branches missed.">        } catch (final IOException e) {</span>
+<span class="fc" id="L780">        final StringWriter out = new StringWriter();</span>
+<span class="fc" id="L781">        try (final CSVPrinter csvPrinter = new CSVPrinter(out, this)) {</span>
+<span class="fc" id="L782">            csvPrinter.printRecord(values);</span>
+<span class="fc" id="L783">            return out.toString().trim();</span>
+<span class="nc" id="L784">        } catch (final IOException e) {</span>
             // should not happen because a StringWriter does not do IO.
-<span class="nc" id="L733">            throw new IllegalStateException(e);</span>
+<span class="nc" id="L786">            throw new IllegalStateException(e);</span>
         }
     }
 
@@ -741,7 +794,17 @@ public final class CSVFormat implements
      *         {@link IllegalArgumentException}.
      */
     public boolean getAllowMissingColumnNames() {
-<span class="fc" id="L744">        return allowMissingColumnNames;</span>
+<span class="fc" id="L797">        return allowMissingColumnNames;</span>
+    }
+
+    /**
+     * Returns whether to flush on close.
+     *
+     * @return whether to flush on close.
+     * @since 1.6
+     */
+    public boolean getAutoFlush() {
+<span class="fc" id="L807">        return autoFlush;</span>
     }
 
     /**
@@ -750,7 +813,7 @@ public final class CSVFormat implements
      * @return the comment start marker, may be {@code null}
      */
     public Character getCommentMarker() {
-<span class="fc" id="L753">        return commentMarker;</span>
+<span class="fc" id="L816">        return commentMarker;</span>
     }
 
     /**
@@ -759,7 +822,7 @@ public final class CSVFormat implements
      * @return the delimiter character
      */
     public char getDelimiter() {
-<span class="fc" id="L762">        return delimiter;</span>
+<span class="fc" id="L825">        return delimiter;</span>
     }
 
     /**
@@ -768,7 +831,7 @@ public final class CSVFormat implements
      * @return the escape character, may be {@code null}
      */
     public Character getEscapeCharacter() {
-<span class="fc" id="L771">        return escapeCharacter;</span>
+<span class="fc" id="L834">        return escapeCharacter;</span>
     }
 
     /**
@@ -777,7 +840,7 @@ public final class CSVFormat implements
      * @return a copy of the header array; {@code null} if disabled, the empty array if to be read from the file
      */
     public String[] getHeader() {
-<span class="fc bfc" id="L780" title="All 2 branches covered.">        return header != null ? header.clone() : null;</span>
+<span class="fc bfc" id="L843" title="All 2 branches covered.">        return header != null ? header.clone() : null;</span>
     }
 
     /**
@@ -786,7 +849,7 @@ public final class CSVFormat implements
      * @return a copy of the header comment array; {@code null} if disabled.
      */
     public String[] getHeaderComments() {
-<span class="fc bfc" id="L789" title="All 2 branches covered.">        return headerComments != null ? headerComments.clone() : null;</span>
+<span class="fc bfc" id="L852" title="All 2 branches covered.">        return headerComments != null ? headerComments.clone() : null;</span>
     }
 
     /**
@@ -796,7 +859,7 @@ public final class CSVFormat implements
      *         records.
      */
     public boolean getIgnoreEmptyLines() {
-<span class="fc" id="L799">        return ignoreEmptyLines;</span>
+<span class="fc" id="L862">        return ignoreEmptyLines;</span>
     }
 
     /**
@@ -806,7 +869,7 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public boolean getIgnoreHeaderCase() {
-<span class="fc" id="L809">        return ignoreHeaderCase;</span>
+<span class="fc" id="L872">        return ignoreHeaderCase;</span>
     }
 
     /**
@@ -815,7 +878,7 @@ public final class CSVFormat implements
      * @return {@code true} if spaces around values are ignored, {@code false} if they are treated as part of the value.
      */
     public boolean getIgnoreSurroundingSpaces() {
-<span class="fc" id="L818">        return ignoreSurroundingSpaces;</span>
+<span class="fc" id="L881">        return ignoreSurroundingSpaces;</span>
     }
 
     /**
@@ -829,7 +892,7 @@ public final class CSVFormat implements
      * @return the String to convert to and from {@code null}. No substitution occurs if {@code null}
      */
     public String getNullString() {
-<span class="fc" id="L832">        return nullString;</span>
+<span class="fc" id="L895">        return nullString;</span>
     }
 
     /**
@@ -838,7 +901,7 @@ public final class CSVFormat implements
      * @return the quoteChar character, may be {@code null}
      */
     public Character getQuoteCharacter() {
-<span class="fc" id="L841">        return quoteCharacter;</span>
+<span class="fc" id="L904">        return quoteCharacter;</span>
     }
 
     /**
@@ -847,7 +910,7 @@ public final class CSVFormat implements
      * @return the quote policy
      */
     public QuoteMode getQuoteMode() {
-<span class="fc" id="L850">        return quoteMode;</span>
+<span class="fc" id="L913">        return quoteMode;</span>
     }
 
     /**
@@ -856,7 +919,7 @@ public final class CSVFormat implements
      * @return the record separator
      */
     public String getRecordSeparator() {
-<span class="fc" id="L859">        return recordSeparator;</span>
+<span class="fc" id="L922">        return recordSeparator;</span>
     }
 
     /**
@@ -865,7 +928,7 @@ public final class CSVFormat implements
      * @return whether to skip the header record.
      */
     public boolean getSkipHeaderRecord() {
-<span class="fc" id="L868">        return skipHeaderRecord;</span>
+<span class="fc" id="L931">        return skipHeaderRecord;</span>
     }
 
     /**
@@ -875,7 +938,7 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public boolean getTrailingDelimiter() {
-<span class="fc" id="L878">        return trailingDelimiter;</span>
+<span class="fc" id="L941">        return trailingDelimiter;</span>
     }
 
     /**
@@ -884,27 +947,27 @@ public final class CSVFormat implements
      * @return whether to trim leading and trailing blanks.
      */
     public boolean getTrim() {
-<span class="fc" id="L887">        return trim;</span>
+<span class="fc" id="L950">        return trim;</span>
     }
 
     @Override
     public int hashCode() {
-<span class="fc" id="L892">        final int prime = 31;</span>
-<span class="fc" id="L893">        int result = 1;</span>
+<span class="fc" id="L955">        final int prime = 31;</span>
+<span class="fc" id="L956">        int result = 1;</span>
 
-<span class="fc" id="L895">        result = prime * result + delimiter;</span>
-<span class="pc bpc" id="L896" title="1 of 2 branches missed.">        result = prime * result + ((quoteMode == null) ? 0 : quoteMode.hashCode());</span>
-<span class="pc bpc" id="L897" title="1 of 2 branches missed.">        result = prime * result + ((quoteCharacter == null) ? 0 : quoteCharacter.hashCode());</span>
-<span class="pc bpc" id="L898" title="1 of 2 branches missed.">        result = prime * result + ((commentMarker == null) ? 0 : commentMarker.hashCode());</span>
-<span class="pc bpc" id="L899" title="1 of 2 branches missed.">        result = prime * result + ((escapeCharacter == null) ? 0 : escapeCharacter.hashCode());</span>
-<span class="pc bpc" id="L900" title="1 of 2 branches missed.">        result = prime * result + ((nullString == null) ? 0 : nullString.hashCode());</span>
-<span class="pc bpc" id="L901" title="1 of 2 branches missed.">        result = prime * result + (ignoreSurroundingSpaces ? 1231 : 1237);</span>
-<span class="fc bfc" id="L902" title="All 2 branches covered.">        result = prime * result + (ignoreHeaderCase ? 1231 : 1237);</span>
-<span class="pc bpc" id="L903" title="1 of 2 branches missed.">        result = prime * result + (ignoreEmptyLines ? 1231 : 1237);</span>
-<span class="pc bpc" id="L904" title="1 of 2 branches missed.">        result = prime * result + (skipHeaderRecord ? 1231 : 1237);</span>
-<span class="pc bpc" id="L905" title="1 of 2 branches missed.">        result = prime * result + ((recordSeparator == null) ? 0 : recordSeparator.hashCode());</span>
-<span class="fc" id="L906">        result = prime * result + Arrays.hashCode(header);</span>
-<span class="fc" id="L907">        return result;</span>
+<span class="fc" id="L958">        result = prime * result + delimiter;</span>
+<span class="pc bpc" id="L959" title="1 of 2 branches missed.">        result = prime * result + ((quoteMode == null) ? 0 : quoteMode.hashCode());</span>
+<span class="pc bpc" id="L960" title="1 of 2 branches missed.">        result = prime * result + ((quoteCharacter == null) ? 0 : quoteCharacter.hashCode());</span>
+<span class="pc bpc" id="L961" title="1 of 2 branches missed.">        result = prime * result + ((commentMarker == null) ? 0 : commentMarker.hashCode());</span>
+<span class="pc bpc" id="L962" title="1 of 2 branches missed.">        result = prime * result + ((escapeCharacter == null) ? 0 : escapeCharacter.hashCode());</span>
+<span class="pc bpc" id="L963" title="1 of 2 branches missed.">        result = prime * result + ((nullString == null) ? 0 : nullString.hashCode());</span>
+<span class="pc bpc" id="L964" title="1 of 2 branches missed.">        result = prime * result + (ignoreSurroundingSpaces ? 1231 : 1237);</span>
+<span class="fc bfc" id="L965" title="All 2 branches covered.">        result = prime * result + (ignoreHeaderCase ? 1231 : 1237);</span>
+<span class="pc bpc" id="L966" title="1 of 2 branches missed.">        result = prime * result + (ignoreEmptyLines ? 1231 : 1237);</span>
+<span class="pc bpc" id="L967" title="1 of 2 branches missed.">        result = prime * result + (skipHeaderRecord ? 1231 : 1237);</span>
+<span class="pc bpc" id="L968" title="1 of 2 branches missed.">        result = prime * result + ((recordSeparator == null) ? 0 : recordSeparator.hashCode());</span>
+<span class="fc" id="L969">        result = prime * result + Arrays.hashCode(header);</span>
+<span class="fc" id="L970">        return result;</span>
     }
 
     /**
@@ -915,7 +978,7 @@ public final class CSVFormat implements
      * @return {@code true} is comments are supported, {@code false} otherwise
      */
     public boolean isCommentMarkerSet() {
-<span class="fc bfc" id="L918" title="All 2 branches covered.">        return commentMarker != null;</span>
+<span class="fc bfc" id="L981" title="All 2 branches covered.">        return commentMarker != null;</span>
     }
 
     /**
@@ -924,7 +987,7 @@ public final class CSVFormat implements
      * @return {@code true} if escapes are processed
      */
     public boolean isEscapeCharacterSet() {
-<span class="fc bfc" id="L927" title="All 2 branches covered.">        return escapeCharacter != null;</span>
+<span class="fc bfc" id="L990" title="All 2 branches covered.">        return escapeCharacter != null;</span>
     }
 
     /**
@@ -933,7 +996,7 @@ public final class CSVFormat implements
      * @return {@code true} if a nullString is defined
      */
     public boolean isNullStringSet() {
-<span class="fc bfc" id="L936" title="All 2 branches covered.">        return nullString != null;</span>
+<span class="fc bfc" id="L999" title="All 2 branches covered.">        return nullString != null;</span>
     }
 
     /**
@@ -942,7 +1005,7 @@ public final class CSVFormat implements
      * @return {@code true} if a quoteChar is defined
      */
     public boolean isQuoteCharacterSet() {
-<span class="fc bfc" id="L945" title="All 2 branches covered.">        return quoteCharacter != null;</span>
+<span class="fc bfc" id="L1008" title="All 2 branches covered.">        return quoteCharacter != null;</span>
     }
 
     /**
@@ -959,7 +1022,7 @@ public final class CSVFormat implements
      *             If an I/O error occurs
      */
     public CSVParser parse(final Reader in) throws IOException {
-<span class="fc" id="L962">        return new CSVParser(in, this);</span>
+<span class="fc" id="L1025">        return new CSVParser(in, this);</span>
     }
 
     /**
@@ -976,23 +1039,7 @@ public final class CSVFormat implements
      *             thrown if the optional header cannot be printed.
      */
     public CSVPrinter print(final Appendable out) throws IOException {
-<span class="fc" id="L979">        return new CSVPrinter(out, this);</span>
-    }
-
-    /**
-     * Prints to the {@link System#out}.
-     *
-     * &lt;p&gt;
-     * See also {@link CSVPrinter}.
-     * &lt;/p&gt;
-     *
-     * @return a printer to {@link System#out}.
-     * @throws IOException
-     *             thrown if the optional header cannot be printed.
-     * @since 1.5
-     */
-    public CSVPrinter printer() throws IOException {
-<span class="fc" id="L995">        return new CSVPrinter(System.out, this);</span>
+<span class="fc" id="L1042">        return new CSVPrinter(out, this);</span>
     }
 
     /**
@@ -1012,29 +1059,9 @@ public final class CSVFormat implements
      * @since 1.5
      */
     @SuppressWarnings(&quot;resource&quot;)
-    public CSVPrinter print(final File out, Charset charset) throws IOException {
+    public CSVPrinter print(final File out, final Charset charset) throws IOException {
         // The writer will be closed when close() is called.
-<span class="fc" id="L1017">        return new CSVPrinter(new OutputStreamWriter(new FileOutputStream(out), charset), this);</span>
-    }
-
-    /**
-     * Prints to the specified output.
-     *
-     * &lt;p&gt;
-     * See also {@link CSVPrinter}.
-     * &lt;/p&gt;
-     *
-     * @param out
-     *            the output.
-     * @param charset
-     *            A charset.
-     * @return a printer to an output.
-     * @throws IOException
-     *             thrown if the optional header cannot be printed.
-     * @since 1.5
-     */
-    public CSVPrinter print(final Path out, Charset charset) throws IOException {
-<span class="fc" id="L1037">        return print(Files.newBufferedWriter(out, charset));</span>
+<span class="fc" id="L1064">        return new CSVPrinter(new OutputStreamWriter(new FileOutputStream(out), charset), this);</span>
     }
 
     /**
@@ -1055,80 +1082,100 @@ public final class CSVFormat implements
         // null values are considered empty
         // Only call CharSequence.toString() if you have to, helps GC-free use cases.
         CharSequence charSequence;
-<span class="fc bfc" id="L1058" title="All 2 branches covered.">        if (value == null) {</span>
+<span class="fc bfc" id="L1085" title="All 2 branches covered.">        if (value == null) {</span>
             // https://issues.apache.org/jira/browse/CSV-203
-<span class="fc bfc" id="L1060" title="All 2 branches covered.">            if (null == nullString) {</span>
-<span class="fc" id="L1061">                charSequence = EMPTY;</span>
+<span class="fc bfc" id="L1087" title="All 2 branches covered.">            if (null == nullString) {</span>
+<span class="fc" id="L1088">                charSequence = EMPTY;</span>
             } else {
-<span class="fc bfc" id="L1063" title="All 2 branches covered.">                if (QuoteMode.ALL == quoteMode) {</span>
-<span class="fc" id="L1064">                    charSequence = quoteCharacter + nullString + quoteCharacter;</span>
+<span class="fc bfc" id="L1090" title="All 2 branches covered.">                if (QuoteMode.ALL == quoteMode) {</span>
+<span class="fc" id="L1091">                    charSequence = quoteCharacter + nullString + quoteCharacter;</span>
                 } else {
-<span class="fc" id="L1066">                    charSequence = nullString;</span>
+<span class="fc" id="L1093">                    charSequence = nullString;</span>
                 }
             }
         } else {
-<span class="fc bfc" id="L1070" title="All 2 branches covered.">            charSequence = value instanceof CharSequence ? (CharSequence) value : value.toString();</span>
+<span class="fc bfc" id="L1097" title="All 2 branches covered.">            charSequence = value instanceof CharSequence ? (CharSequence) value : value.toString();</span>
         }
-<span class="fc bfc" id="L1072" title="All 2 branches covered.">        charSequence = getTrim() ? trim(charSequence) : charSequence;</span>
-<span class="fc" id="L1073">        this.print(value, charSequence, 0, charSequence.length(), out, newRecord);</span>
-<span class="fc" id="L1074">    }</span>
+<span class="fc bfc" id="L1099" title="All 2 branches covered.">        charSequence = getTrim() ? trim(charSequence) : charSequence;</span>
+<span class="fc" id="L1100">        this.print(value, charSequence, 0, charSequence.length(), out, newRecord);</span>
+<span class="fc" id="L1101">    }</span>
 
     private void print(final Object object, final CharSequence value, final int offset, final int len,
             final Appendable out, final boolean newRecord) throws IOException {
-<span class="fc bfc" id="L1078" title="All 2 branches covered.">        if (!newRecord) {</span>
-<span class="fc" id="L1079">            out.append(getDelimiter());</span>
+<span class="fc bfc" id="L1105" title="All 2 branches covered.">        if (!newRecord) {</span>
+<span class="fc" id="L1106">            out.append(getDelimiter());</span>
         }
-<span class="fc bfc" id="L1081" title="All 2 branches covered.">        if (object == null) {</span>
-<span class="fc" id="L1082">            out.append(value);</span>
-<span class="fc bfc" id="L1083" title="All 2 branches covered.">        } else if (isQuoteCharacterSet()) {</span>
+<span class="fc bfc" id="L1108" title="All 2 branches covered.">        if (object == null) {</span>
+<span class="fc" id="L1109">            out.append(value);</span>
+<span class="fc bfc" id="L1110" title="All 2 branches covered.">        } else if (isQuoteCharacterSet()) {</span>
             // the original object is needed so can check for Number
-<span class="fc" id="L1085">            printAndQuote(object, value, offset, len, out, newRecord);</span>
-<span class="fc bfc" id="L1086" title="All 2 branches covered.">        } else if (isEscapeCharacterSet()) {</span>
-<span class="fc" id="L1087">            printAndEscape(value, offset, len, out);</span>
+<span class="fc" id="L1112">            printAndQuote(object, value, offset, len, out, newRecord);</span>
+<span class="fc bfc" id="L1113" title="All 2 branches covered.">        } else if (isEscapeCharacterSet()) {</span>
+<span class="fc" id="L1114">            printAndEscape(value, offset, len, out);</span>
         } else {
-<span class="fc" id="L1089">            out.append(value, offset, offset + len);</span>
+<span class="fc" id="L1116">            out.append(value, offset, offset + len);</span>
         }
-<span class="fc" id="L1091">    }</span>
+<span class="fc" id="L1118">    }</span>
+
+    /**
+     * Prints to the specified output.
+     *
+     * &lt;p&gt;
+     * See also {@link CSVPrinter}.
+     * &lt;/p&gt;
+     *
+     * @param out
+     *            the output.
+     * @param charset
+     *            A charset.
+     * @return a printer to an output.
+     * @throws IOException
+     *             thrown if the optional header cannot be printed.
+     * @since 1.5
+     */
+    public CSVPrinter print(final Path out, final Charset charset) throws IOException {
+<span class="fc" id="L1137">        return print(Files.newBufferedWriter(out, charset));</span>
+    }
 
     /*
      * Note: must only be called if escaping is enabled, otherwise will generate NPE
      */
     private void printAndEscape(final CharSequence value, final int offset, final int len, final Appendable out)
             throws IOException {
-<span class="fc" id="L1098">        int start = offset;</span>
-<span class="fc" id="L1099">        int pos = offset;</span>
-<span class="fc" id="L1100">        final int end = offset + len;</span>
-
-<span class="fc" id="L1102">        final char delim = getDelimiter();</span>
-<span class="fc" id="L1103">        final char escape = getEscapeCharacter().charValue();</span>
-
-<span class="fc bfc" id="L1105" title="All 2 branches covered.">        while (pos &lt; end) {</span>
-<span class="fc" id="L1106">            char c = value.charAt(pos);</span>
-<span class="fc bfc" id="L1107" title="All 8 branches covered.">            if (c == CR || c == LF || c == delim || c == escape) {</span>
+<span class="fc" id="L1145">        int start = offset;</span>
+<span class="fc" id="L1146">        int pos = offset;</span>
+<span class="fc" id="L1147">        final int end = offset + len;</span>
+
+<span class="fc" id="L1149">        final char delim = getDelimiter();</span>
+<span class="fc" id="L1150">        final char escape = getEscapeCharacter().charValue();</span>
+
+<span class="fc bfc" id="L1152" title="All 2 branches covered.">        while (pos &lt; end) {</span>
+<span class="fc" id="L1153">            char c = value.charAt(pos);</span>
+<span class="fc bfc" id="L1154" title="All 8 branches covered.">            if (c == CR || c == LF || c == delim || c == escape) {</span>
                 // write out segment up until this char
-<span class="fc bfc" id="L1109" title="All 2 branches covered.">                if (pos &gt; start) {</span>
-<span class="fc" id="L1110">                    out.append(value, start, pos);</span>
+<span class="fc bfc" id="L1156" title="All 2 branches covered.">                if (pos &gt; start) {</span>
+<span class="fc" id="L1157">                    out.append(value, start, pos);</span>
                 }
-<span class="fc bfc" id="L1112" title="All 2 branches covered.">                if (c == LF) {</span>
-<span class="fc" id="L1113">                    c = 'n';</span>
-<span class="fc bfc" id="L1114" title="All 2 branches covered.">                } else if (c == CR) {</span>
-<span class="fc" id="L1115">                    c = 'r';</span>
+<span class="fc bfc" id="L1159" title="All 2 branches covered.">                if (c == LF) {</span>
+<span class="fc" id="L1160">                    c = 'n';</span>
+<span class="fc bfc" id="L1161" title="All 2 branches covered.">                } else if (c == CR) {</span>
+<span class="fc" id="L1162">                    c = 'r';</span>
                 }
 
-<span class="fc" id="L1118">                out.append(escape);</span>
-<span class="fc" id="L1119">                out.append(c);</span>
+<span class="fc" id="L1165">                out.append(escape);</span>
+<span class="fc" id="L1166">                out.append(c);</span>
 
-<span class="fc" id="L1121">                start = pos + 1; // start on the current char after this one</span>
+<span class="fc" id="L1168">                start = pos + 1; // start on the current char after this one</span>
             }
 
-<span class="fc" id="L1124">            pos++;</span>
-<span class="fc" id="L1125">        }</span>
+<span class="fc" id="L1171">            pos++;</span>
+<span class="fc" id="L1172">        }</span>
 
         // write last segment
-<span class="fc bfc" id="L1128" title="All 2 branches covered.">        if (pos &gt; start) {</span>
-<span class="fc" id="L1129">            out.append(value, start, pos);</span>
+<span class="fc bfc" id="L1175" title="All 2 branches covered.">        if (pos &gt; start) {</span>
+<span class="fc" id="L1176">            out.append(value, start, pos);</span>
         }
-<span class="fc" id="L1131">    }</span>
+<span class="fc" id="L1178">    }</span>
 
     /*
      * Note: must only be called if quoting is enabled, otherwise will generate NPE
@@ -1136,111 +1183,124 @@ public final class CSVFormat implements
     // the original object is needed so can check for Number
     private void printAndQuote(final Object object, final CharSequence value, final int offset, final int len,
             final Appendable out, final boolean newRecord) throws IOException {
-<span class="fc" id="L1139">        boolean quote = false;</span>
-<span class="fc" id="L1140">        int start = offset;</span>
-<span class="fc" id="L1141">        int pos = offset;</span>
-<span class="fc" id="L1142">        final int end = offset + len;</span>
-
-<span class="fc" id="L1144">        final char delimChar = getDelimiter();</span>
-<span class="fc" id="L1145">        final char quoteChar = getQuoteCharacter().charValue();</span>
-
-<span class="fc" id="L1147">        QuoteMode quoteModePolicy = getQuoteMode();</span>
-<span class="fc bfc" id="L1148" title="All 2 branches covered.">        if (quoteModePolicy == null) {</span>
-<span class="fc" id="L1149">            quoteModePolicy = QuoteMode.MINIMAL;</span>
+<span class="fc" id="L1186">        boolean quote = false;</span>
+<span class="fc" id="L1187">        int start = offset;</span>
+<span class="fc" id="L1188">        int pos = offset;</span>
+<span class="fc" id="L1189">        final int end = offset + len;</span>
+
+<span class="fc" id="L1191">        final char delimChar = getDelimiter();</span>
+<span class="fc" id="L1192">        final char quoteChar = getQuoteCharacter().charValue();</span>
+
+<span class="fc" id="L1194">        QuoteMode quoteModePolicy = getQuoteMode();</span>
+<span class="fc bfc" id="L1195" title="All 2 branches covered.">        if (quoteModePolicy == null) {</span>
+<span class="fc" id="L1196">            quoteModePolicy = QuoteMode.MINIMAL;</span>
         }
-<span class="pc bpc" id="L1151" title="1 of 5 branches missed.">        switch (quoteModePolicy) {</span>
+<span class="pc bpc" id="L1198" title="1 of 5 branches missed.">        switch (quoteModePolicy) {</span>
         case ALL:
         case ALL_NON_NULL:
-<span class="fc" id="L1154">            quote = true;</span>
-<span class="fc" id="L1155">            break;</span>
+<span class="fc" id="L1201">            quote = true;</span>
+<span class="fc" id="L1202">            break;</span>
         case NON_NUMERIC:
-<span class="fc bfc" id="L1157" title="All 2 branches covered.">            quote = !(object instanceof Number);</span>
-<span class="fc" id="L1158">            break;</span>
+<span class="fc bfc" id="L1204" title="All 2 branches covered.">            quote = !(object instanceof Number);</span>
+<span class="fc" id="L1205">            break;</span>
         case NONE:
             // Use the existing escaping code
-<span class="fc" id="L1161">            printAndEscape(value, offset, len, out);</span>
-<span class="fc" id="L1162">            return;</span>
+<span class="fc" id="L1208">            printAndEscape(value, offset, len, out);</span>
+<span class="fc" id="L1209">            return;</span>
         case MINIMAL:
-<span class="fc bfc" id="L1164" title="All 2 branches covered.">            if (len &lt;= 0) {</span>
+<span class="fc bfc" id="L1211" title="All 2 branches covered.">            if (len &lt;= 0) {</span>
                 // always quote an empty token that is the first
                 // on the line, as it may be the only thing on the
                 // line. If it were not quoted in that case,
                 // an empty line has no tokens.
-<span class="fc bfc" id="L1169" title="All 2 branches covered.">                if (newRecord) {</span>
-<span class="fc" id="L1170">                    quote = true;</span>
+<span class="fc bfc" id="L1216" title="All 2 branches covered.">                if (newRecord) {</span>
+<span class="fc" id="L1217">                    quote = true;</span>
                 }
             } else {
-<span class="fc" id="L1173">                char c = value.charAt(pos);</span>
+<span class="fc" id="L1220">                char c = value.charAt(pos);</span>
 
-                // RFC4180 (https://tools.ietf.org/html/rfc4180) TEXTDATA =  %x20-21 / %x23-2B / %x2D-7E
-<span class="fc bfc" id="L1176" title="All 14 branches covered.">                if (newRecord &amp;&amp; (c &lt; 0x20 || c &gt; 0x21 &amp;&amp; c &lt; 0x23 || c &gt; 0x2B &amp;&amp; c &lt; 0x2D || c &gt; 0x7E)) {</span>
-<span class="fc" id="L1177">                    quote = true;</span>
-<span class="fc bfc" id="L1178" title="All 2 branches covered.">                } else if (c &lt;= COMMENT) {</span>
+<span class="fc bfc" id="L1222" title="All 2 branches covered.">                if (c &lt;= COMMENT) {</span>
                     // Some other chars at the start of a value caused the parser to fail, so for now
                     // encapsulate if we start in anything less than '#'. We are being conservative
                     // by including the default comment char too.
-<span class="fc" id="L1182">                    quote = true;</span>
+<span class="fc" id="L1226">                    quote = true;</span>
                 } else {
-<span class="fc bfc" id="L1184" title="All 2 branches covered.">                    while (pos &lt; end) {</span>
-<span class="fc" id="L1185">                        c = value.charAt(pos);</span>
-<span class="fc bfc" id="L1186" title="All 8 branches covered.">                        if (c == LF || c == CR || c == quoteChar || c == delimChar) {</span>
-<span class="fc" id="L1187">                            quote = true;</span>
-<span class="fc" id="L1188">                            break;</span>
+<span class="fc bfc" id="L1228" title="All 2 branches covered.">                    while (pos &lt; end) {</span>
+<span class="fc" id="L1229">                        c = value.charAt(pos);</span>
+<span class="fc bfc" id="L1230" title="All 8 branches covered.">                        if (c == LF || c == CR || c == quoteChar || c == delimChar) {</span>
+<span class="fc" id="L1231">                            quote = true;</span>
+<span class="fc" id="L1232">                            break;</span>
                         }
-<span class="fc" id="L1190">                        pos++;</span>
+<span class="fc" id="L1234">                        pos++;</span>
                     }
 
-<span class="fc bfc" id="L1193" title="All 2 branches covered.">                    if (!quote) {</span>
-<span class="fc" id="L1194">                        pos = end - 1;</span>
-<span class="fc" id="L1195">                        c = value.charAt(pos);</span>
+<span class="fc bfc" id="L1237" title="All 2 branches covered.">                    if (!quote) {</span>
+<span class="fc" id="L1238">                        pos = end - 1;</span>
+<span class="fc" id="L1239">                        c = value.charAt(pos);</span>
                         // Some other chars at the end caused the parser to fail, so for now
                         // encapsulate if we end in anything less than ' '
-<span class="fc bfc" id="L1198" title="All 2 branches covered.">                        if (c &lt;= SP) {</span>
-<span class="fc" id="L1199">                            quote = true;</span>
+<span class="fc bfc" id="L1242" title="All 2 branches covered.">                        if (c &lt;= SP) {</span>
+<span class="fc" id="L1243">                            quote = true;</span>
                         }
                     }
                 }
             }
 
-<span class="fc bfc" id="L1205" title="All 2 branches covered.">            if (!quote) {</span>
+<span class="fc bfc" id="L1249" title="All 2 branches covered.">            if (!quote) {</span>
                 // no encapsulation needed - write out the original value
-<span class="fc" id="L1207">                out.append(value, start, end);</span>
-<span class="fc" id="L1208">                return;</span>
+<span class="fc" id="L1251">                out.append(value, start, end);</span>
+<span class="fc" id="L1252">                return;</span>
             }
             break;
         default:
-<span class="nc" id="L1212">            throw new IllegalStateException(&quot;Unexpected Quote value: &quot; + quoteModePolicy);</span>
+<span class="nc" id="L1256">            throw new IllegalStateException(&quot;Unexpected Quote value: &quot; + quoteModePolicy);</span>
         }
 
-<span class="fc bfc" id="L1215" title="All 2 branches covered.">        if (!quote) {</span>
+<span class="fc bfc" id="L1259" title="All 2 branches covered.">        if (!quote) {</span>
             // no encapsulation needed - write out the original value
-<span class="fc" id="L1217">            out.append(value, start, end);</span>
-<span class="fc" id="L1218">            return;</span>
+<span class="fc" id="L1261">            out.append(value, start, end);</span>
+<span class="fc" id="L1262">            return;</span>
         }
 
         // we hit something that needed encapsulation
-<span class="fc" id="L1222">        out.append(quoteChar);</span>
+<span class="fc" id="L1266">        out.append(quoteChar);</span>
 
         // Pick up where we left off: pos should be positioned on the first character that caused
         // the need for encapsulation.
-<span class="fc bfc" id="L1226" title="All 2 branches covered.">        while (pos &lt; end) {</span>
-<span class="fc" id="L1227">            final char c = value.charAt(pos);</span>
-<span class="fc bfc" id="L1228" title="All 2 branches covered.">            if (c == quoteChar) {</span>
+<span class="fc bfc" id="L1270" title="All 2 branches covered.">        while (pos &lt; end) {</span>
+<span class="fc" id="L1271">            final char c = value.charAt(pos);</span>
+<span class="fc bfc" id="L1272" title="All 2 branches covered.">            if (c == quoteChar) {</span>
                 // write out the chunk up until this point
 
                 // add 1 to the length to write out the encapsulator also
-<span class="fc" id="L1232">                out.append(value, start, pos + 1);</span>
+<span class="fc" id="L1276">                out.append(value, start, pos + 1);</span>
                 // put the next starting position on the encapsulator so we will
                 // write it out again with the next string (effectively doubling it)
-<span class="fc" id="L1235">                start = pos;</span>
+<span class="fc" id="L1279">                start = pos;</span>
             }
-<span class="fc" id="L1237">            pos++;</span>
-<span class="fc" id="L1238">        }</span>
+<span class="fc" id="L1281">            pos++;</span>
+<span class="fc" id="L1282">        }</span>
 
         // write the last segment
-<span class="fc" id="L1241">        out.append(value, start, pos);</span>
-<span class="fc" id="L1242">        out.append(quoteChar);</span>
-<span class="fc" id="L1243">    }</span>
+<span class="fc" id="L1285">        out.append(value, start, pos);</span>
+<span class="fc" id="L1286">        out.append(quoteChar);</span>
+<span class="fc" id="L1287">    }</span>
+
+    /**
+     * Prints to the {@link System#out}.
+     *
+     * &lt;p&gt;
+     * See also {@link CSVPrinter}.
+     * &lt;/p&gt;
+     *
+     * @return a printer to {@link System#out}.
+     * @throws IOException
+     *             thrown if the optional header cannot be printed.
+     * @since 1.5
+     */
+    public CSVPrinter printer() throws IOException {
+<span class="fc" id="L1302">        return new CSVPrinter(System.out, this);</span>
+    }
 
     /**
      * Outputs the trailing delimiter (if set) followed by the record separator (if set).
@@ -1252,13 +1312,13 @@ public final class CSVFormat implements
      * @since 1.4
      */
     public void println(final Appendable out) throws IOException {
-<span class="fc bfc" id="L1255" title="All 2 branches covered.">        if (getTrailingDelimiter()) {</span>
-<span class="fc" id="L1256">            out.append(getDelimiter());</span>
+<span class="fc bfc" id="L1315" title="All 2 branches covered.">        if (getTrailingDelimiter()) {</span>
+<span class="fc" id="L1316">            out.append(getDelimiter());</span>
         }
-<span class="fc bfc" id="L1258" title="All 2 branches covered.">        if (recordSeparator != null) {</span>
-<span class="fc" id="L1259">            out.append(recordSeparator);</span>
+<span class="fc bfc" id="L1318" title="All 2 branches covered.">        if (recordSeparator != null) {</span>
+<span class="fc" id="L1319">            out.append(recordSeparator);</span>
         }
-<span class="fc" id="L1261">    }</span>
+<span class="fc" id="L1321">    }</span>
 
     /**
      * Prints the given {@code values} to {@code out} as a single record of delimiter separated values followed by the
@@ -1278,84 +1338,84 @@ public final class CSVFormat implements
      * @since 1.4
      */
     public void printRecord(final Appendable out, final Object... values) throws IOException {
-<span class="fc bfc" id="L1281" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
-<span class="fc bfc" id="L1282" title="All 2 branches covered.">            print(values[i], out, i == 0);</span>
+<span class="fc bfc" id="L1341" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
+<span class="fc bfc" id="L1342" title="All 2 branches covered.">            print(values[i], out, i == 0);</span>
         }
-<span class="fc" id="L1284">        println(out);</span>
-<span class="fc" id="L1285">    }</span>
+<span class="fc" id="L1344">        println(out);</span>
+<span class="fc" id="L1345">    }</span>
 
     @Override
     public String toString() {
-<span class="fc" id="L1289">        final StringBuilder sb = new StringBuilder();</span>
-<span class="fc" id="L1290">        sb.append(&quot;Delimiter=&lt;&quot;).append(delimiter).append('&gt;');</span>
-<span class="fc bfc" id="L1291" title="All 2 branches covered.">        if (isEscapeCharacterSet()) {</span>
-<span class="fc" id="L1292">            sb.append(' ');</span>
-<span class="fc" id="L1293">            sb.append(&quot;Escape=&lt;&quot;).append(escapeCharacter).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L1295" title="1 of 2 branches missed.">        if (isQuoteCharacterSet()) {</span>
-<span class="fc" id="L1296">            sb.append(' ');</span>
-<span class="fc" id="L1297">            sb.append(&quot;QuoteChar=&lt;&quot;).append(quoteCharacter).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L1299" title="All 2 branches covered.">        if (isCommentMarkerSet()) {</span>
-<span class="fc" id="L1300">            sb.append(' ');</span>
-<span class="fc" id="L1301">            sb.append(&quot;CommentStart=&lt;&quot;).append(commentMarker).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L1303" title="1 of 2 branches missed.">        if (isNullStringSet()) {</span>
-<span class="nc" id="L1304">            sb.append(' ');</span>
-<span class="nc" id="L1305">            sb.append(&quot;NullString=&lt;&quot;).append(nullString).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L1307" title="All 2 branches covered.">        if (recordSeparator != null) {</span>
-<span class="fc" id="L1308">            sb.append(' ');</span>
-<span class="fc" id="L1309">            sb.append(&quot;RecordSeparator=&lt;&quot;).append(recordSeparator).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L1311" title="All 2 branches covered.">        if (getIgnoreEmptyLines()) {</span>
-<span class="fc" id="L1312">            sb.append(&quot; EmptyLines:ignored&quot;);</span>
-        }
-<span class="fc bfc" id="L1314" title="All 2 branches covered.">        if (getIgnoreSurroundingSpaces()) {</span>
-<span class="fc" id="L1315">            sb.append(&quot; SurroundingSpaces:ignored&quot;);</span>
-        }
-<span class="pc bpc" id="L1317" title="1 of 2 branches missed.">        if (getIgnoreHeaderCase()) {</span>
-<span class="nc" id="L1318">            sb.append(&quot; IgnoreHeaderCase:ignored&quot;);</span>
-        }
-<span class="fc" id="L1320">        sb.append(&quot; SkipHeaderRecord:&quot;).append(skipHeaderRecord);</span>
-<span class="pc bpc" id="L1321" title="1 of 2 branches missed.">        if (headerComments != null) {</span>
-<span class="nc" id="L1322">            sb.append(' ');</span>
-<span class="nc" id="L1323">            sb.append(&quot;HeaderComments:&quot;).append(Arrays.toString(headerComments));</span>
-        }
-<span class="pc bpc" id="L1325" title="1 of 2 branches missed.">        if (header != null) {</span>
-<span class="nc" id="L1326">            sb.append(' ');</span>
-<span class="nc" id="L1327">            sb.append(&quot;Header:&quot;).append(Arrays.toString(header));</span>
+<span class="fc" id="L1349">        final StringBuilder sb = new StringBuilder();</span>
+<span class="fc" id="L1350">        sb.append(&quot;Delimiter=&lt;&quot;).append(delimiter).append('&gt;');</span>
+<span class="fc bfc" id="L1351" title="All 2 branches covered.">        if (isEscapeCharacterSet()) {</span>
+<span class="fc" id="L1352">            sb.append(' ');</span>
+<span class="fc" id="L1353">            sb.append(&quot;Escape=&lt;&quot;).append(escapeCharacter).append('&gt;');</span>
+        }
+<span class="pc bpc" id="L1355" title="1 of 2 branches missed.">        if (isQuoteCharacterSet()) {</span>
+<span class="fc" id="L1356">            sb.append(' ');</span>
+<span class="fc" id="L1357">            sb.append(&quot;QuoteChar=&lt;&quot;).append(quoteCharacter).append('&gt;');</span>
+        }
+<span class="fc bfc" id="L1359" title="All 2 branches covered.">        if (isCommentMarkerSet()) {</span>
+<span class="fc" id="L1360">            sb.append(' ');</span>
+<span class="fc" id="L1361">            sb.append(&quot;CommentStart=&lt;&quot;).append(commentMarker).append('&gt;');</span>
+        }
+<span class="pc bpc" id="L1363" title="1 of 2 branches missed.">        if (isNullStringSet()) {</span>
+<span class="nc" id="L1364">            sb.append(' ');</span>
+<span class="nc" id="L1365">            sb.append(&quot;NullString=&lt;&quot;).append(nullString).append('&gt;');</span>
+        }
+<span class="fc bfc" id="L1367" title="All 2 branches covered.">        if (recordSeparator != null) {</span>
+<span class="fc" id="L1368">            sb.append(' ');</span>
+<span class="fc" id="L1369">            sb.append(&quot;RecordSeparator=&lt;&quot;).append(recordSeparator).append('&gt;');</span>
+        }
+<span class="fc bfc" id="L1371" title="All 2 branches covered.">        if (getIgnoreEmptyLines()) {</span>
+<span class="fc" id="L1372">            sb.append(&quot; EmptyLines:ignored&quot;);</span>
+        }
+<span class="fc bfc" id="L1374" title="All 2 branches covered.">        if (getIgnoreSurroundingSpaces()) {</span>
+<span class="fc" id="L1375">            sb.append(&quot; SurroundingSpaces:ignored&quot;);</span>
+        }
+<span class="pc bpc" id="L1377" title="1 of 2 branches missed.">        if (getIgnoreHeaderCase()) {</span>
+<span class="nc" id="L1378">            sb.append(&quot; IgnoreHeaderCase:ignored&quot;);</span>
+        }
+<span class="fc" id="L1380">        sb.append(&quot; SkipHeaderRecord:&quot;).append(skipHeaderRecord);</span>
+<span class="pc bpc" id="L1381" title="1 of 2 branches missed.">        if (headerComments != null) {</span>
+<span class="nc" id="L1382">            sb.append(' ');</span>
+<span class="nc" id="L1383">            sb.append(&quot;HeaderComments:&quot;).append(Arrays.toString(headerComments));</span>
+        }
+<span class="pc bpc" id="L1385" title="1 of 2 branches missed.">        if (header != null) {</span>
+<span class="nc" id="L1386">            sb.append(' ');</span>
+<span class="nc" id="L1387">            sb.append(&quot;Header:&quot;).append(Arrays.toString(header));</span>
         }
-<span class="fc" id="L1329">        return sb.toString();</span>
+<span class="fc" id="L1389">        return sb.toString();</span>
     }
 
     private String[] toStringArray(final Object[] values) {
-<span class="fc bfc" id="L1333" title="All 2 branches covered.">        if (values == null) {</span>
-<span class="fc" id="L1334">            return null;</span>
+<span class="fc bfc" id="L1393" title="All 2 branches covered.">        if (values == null) {</span>
+<span class="fc" id="L1394">            return null;</span>
         }
-<span class="fc" id="L1336">        final String[] strings = new String[values.length];</span>
-<span class="fc bfc" id="L1337" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
-<span class="fc" id="L1338">            final Object value = values[i];</span>
-<span class="fc bfc" id="L1339" title="All 2 branches covered.">            strings[i] = value == null ? null : value.toString();</span>
+<span class="fc" id="L1396">        final String[] strings = new String[values.length];</span>
+<span class="fc bfc" id="L1397" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
+<span class="fc" id="L1398">            final Object value = values[i];</span>
+<span class="fc bfc" id="L1399" title="All 2 branches covered.">            strings[i] = value == null ? null : value.toString();</span>
         }
-<span class="fc" id="L1341">        return strings;</span>
+<span class="fc" id="L1401">        return strings;</span>
     }
 
     private CharSequence trim(final CharSequence charSequence) {
-<span class="pc bpc" id="L1345" title="1 of 2 branches missed.">        if (charSequence instanceof String) {</span>
-<span class="fc" id="L1346">            return ((String) charSequence).trim();</span>
+<span class="pc bpc" id="L1405" title="1 of 2 branches missed.">        if (charSequence instanceof String) {</span>
+<span class="fc" id="L1406">            return ((String) charSequence).trim();</span>
         }
-<span class="nc" id="L1348">        final int count = charSequence.length();</span>
-<span class="nc" id="L1349">        int len = count;</span>
-<span class="nc" id="L1350">        int pos = 0;</span>
+<span class="nc" id="L1408">        final int count = charSequence.length();</span>
+<span class="nc" id="L1409">        int len = count;</span>
+<span class="nc" id="L1410">        int pos = 0;</span>
 
-<span class="nc bnc" id="L1352" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(pos) &lt;= SP) {</span>
-<span class="nc" id="L1353">            pos++;</span>
+<span class="nc bnc" id="L1412" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(pos) &lt;= SP) {</span>
+<span class="nc" id="L1413">            pos++;</span>
         }
-<span class="nc bnc" id="L1355" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(len - 1) &lt;= SP) {</span>
-<span class="nc" id="L1356">            len--;</span>
+<span class="nc bnc" id="L1415" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(len - 1) &lt;= SP) {</span>
+<span class="nc" id="L1416">            len--;</span>
         }
-<span class="nc bnc" id="L1358" title="All 4 branches missed.">        return pos &gt; 0 || len &lt; count ? charSequence.subSequence(pos, len) : charSequence;</span>
+<span class="nc bnc" id="L1418" title="All 4 branches missed.">        return pos &gt; 0 || len &lt; count ? charSequence.subSequence(pos, len) : charSequence;</span>
     }
 
     /**
@@ -1364,50 +1424,50 @@ public final class CSVFormat implements
      * @throws IllegalArgumentException
      */
     private void validate() throws IllegalArgumentException {
-<span class="pc bpc" id="L1367" title="1 of 2 branches missed.">        if (isLineBreak(delimiter)) {</span>
-<span class="nc" id="L1368">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
+<span class="pc bpc" id="L1427" title="1 of 2 branches missed.">        if (isLineBreak(delimiter)) {</span>
+<span class="nc" id="L1428">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
         }
 
-<span class="fc bfc" id="L1371" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; delimiter == quoteCharacter.charValue()) {</span>
-<span class="fc" id="L1372">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1431" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; delimiter == quoteCharacter.charValue()) {</span>
+<span class="fc" id="L1432">            throw new IllegalArgumentException(</span>
                     &quot;The quoteChar character and the delimiter cannot be the same ('&quot; + quoteCharacter + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1376" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; delimiter == escapeCharacter.charValue()) {</span>
-<span class="fc" id="L1377">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1436" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; delimiter == escapeCharacter.charValue()) {</span>
+<span class="fc" id="L1437">            throw new IllegalArgumentException(</span>
                     &quot;The escape character and the delimiter cannot be the same ('&quot; + escapeCharacter + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1381" title="All 4 branches covered.">        if (commentMarker != null &amp;&amp; delimiter == commentMarker.charValue()) {</span>
-<span class="fc" id="L1382">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1441" title="All 4 branches covered.">        if (commentMarker != null &amp;&amp; delimiter == commentMarker.charValue()) {</span>
+<span class="fc" id="L1442">            throw new IllegalArgumentException(</span>
                     &quot;The comment start character and the delimiter cannot be the same ('&quot; + commentMarker + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1386" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; quoteCharacter.equals(commentMarker)) {</span>
-<span class="fc" id="L1387">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1446" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; quoteCharacter.equals(commentMarker)) {</span>
+<span class="fc" id="L1447">            throw new IllegalArgumentException(</span>
                     &quot;The comment start character and the quoteChar cannot be the same ('&quot; + commentMarker + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1391" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; escapeCharacter.equals(commentMarker)) {</span>
-<span class="fc" id="L1392">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1451" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; escapeCharacter.equals(commentMarker)) {</span>
+<span class="fc" id="L1452">            throw new IllegalArgumentException(</span>
                     &quot;The comment start and the escape character cannot be the same ('&quot; + commentMarker + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1396" title="All 4 branches covered.">        if (escapeCharacter == null &amp;&amp; quoteMode == QuoteMode.NONE) {</span>
-<span class="fc" id="L1397">            throw new IllegalArgumentException(&quot;No quotes mode set but no escape character is set&quot;);</span>
+<span class="fc bfc" id="L1456" title="All 4 branches covered.">        if (escapeCharacter == null &amp;&amp; quoteMode == QuoteMode.NONE) {</span>
+<span class="fc" id="L1457">            throw new IllegalArgumentException(&quot;No quotes mode set but no escape character is set&quot;);</span>
         }
 
         // validate header
-<span class="fc bfc" id="L1401" title="All 2 branches covered.">        if (header != null) {</span>
-<span class="fc" id="L1402">            final Set&lt;String&gt; dupCheck = new HashSet&lt;&gt;();</span>
-<span class="fc bfc" id="L1403" title="All 2 branches covered.">            for (final String hdr : header) {</span>
-<span class="fc bfc" id="L1404" title="All 2 branches covered.">                if (!dupCheck.add(hdr)) {</span>
-<span class="fc" id="L1405">                    throw new IllegalArgumentException(</span>
-<span class="fc" id="L1406">                            &quot;The header contains a duplicate entry: '&quot; + hdr + &quot;' in &quot; + Arrays.toString(header));</span>
+<span class="fc bfc" id="L1461" title="All 2 branches covered.">        if (header != null) {</span>
+<span class="fc" id="L1462">            final Set&lt;String&gt; dupCheck = new HashSet&lt;&gt;();</span>
+<span class="fc bfc" id="L1463" title="All 2 branches covered.">            for (final String hdr : header) {</span>
+<span class="fc bfc" id="L1464" title="All 2 branches covered.">                if (!dupCheck.add(hdr)) {</span>
+<span class="fc" id="L1465">                    throw new IllegalArgumentException(</span>
+<span class="fc" id="L1466">                            &quot;The header contains a duplicate entry: '&quot; + hdr + &quot;' in &quot; + Arrays.toString(header));</span>
                 }
             }
         }
-<span class="fc" id="L1410">    }</span>
+<span class="fc" id="L1470">    }</span>
 
     /**
      * Returns a new {@code CSVFormat} with the missing column names behavior of the format set to {@code true}
@@ -1417,7 +1477,7 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withAllowMissingColumnNames() {
-<span class="fc" id="L1420">        return this.withAllowMissingColumnNames(true);</span>
+<span class="fc" id="L1480">        return this.withAllowMissingColumnNames(true);</span>
     }
 
     /**
@@ -1429,9 +1489,24 @@ public final class CSVFormat implements
      * @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
      */
     public CSVFormat withAllowMissingColumnNames(final boolean allowMissingColumnNames) {
-<span class="fc" id="L1432">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1492">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
+    }
+
+    /**
+     * Returns a new {@code CSVFormat} with whether to flush on close.
+     *
+     * @param autoFlush
+     *            whether to flush on close.
+     *
+     * @return A new CSVFormat that is equal to this but with the specified autoFlush setting.
+     * @since 1.6
+     */
+    public CSVFormat withAutoFlush(final boolean autoFlush) {
+<span class="fc" id="L1507">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+            ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
+            skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
     }
 
     /**
@@ -1446,7 +1521,7 @@ public final class CSVFormat implements
      *             thrown if the specified character is a line break
      */
     public CSVFormat withCommentMarker(final char commentMarker) {
-<span class="fc" id="L1449">        return withCommentMarker(Character.valueOf(commentMarker));</span>
+<span class="fc" id="L1524">        return withCommentMarker(Character.valueOf(commentMarker));</span>
     }
 
     /**
@@ -1461,12 +1536,12 @@ public final class CSVFormat implements
      *             thrown if the specified character is a line break
      */
     public CSVFormat withCommentMarker(final Character commentMarker) {
-<span class="fc bfc" id="L1464" title="All 2 branches covered.">        if (isLineBreak(commentMarker)) {</span>
-<span class="fc" id="L1465">            throw new IllegalArgumentException(&quot;The comment start marker character cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1539" title="All 2 branches covered.">        if (isLineBreak(commentMarker)) {</span>
+<span class="fc" id="L1540">            throw new IllegalArgumentException(&quot;The comment start marker character cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L1467">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1542">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
     }
 
     /**
@@ -1479,12 +1554,12 @@ public final class CSVFormat implements
      *             thrown if the specified character is a line break
      */
     public CSVFormat withDelimiter(final char delimiter) {
-<span class="fc bfc" id="L1482" title="All 2 branches covered.">        if (isLineBreak(delimiter)) {</span>
-<span class="fc" id="L1483">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1557" title="All 2 branches covered.">        if (isLineBreak(delimiter)) {</span>
+<span class="fc" id="L1558">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L1485">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1560">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,

[... 356 lines stripped ...]