You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@commons.apache.org by ki...@apache.org on 2017/09/03 05:34:10 UTC

svn commit: r1017635 [17/40] - 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/ images/ jacoco-aggregate/ jacoco-a...

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 Sun Sep  3 05:34:03 2017
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>CSVFormat.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons CSV</a> &gt; <a href="index.source.html" class="el_package">org.apache.commons.csv</a> &gt; <span class="el_source">CSVFormat.java</span></div><h1>CSVFormat.j
 ava</h1><pre class="source lang-java linenums">/*
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>CSVFormat.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons CSV</a> &gt; <a href="index.source.html" class="el_package">org.apache.commons.csv</a> &gt; <span class="el_source">CSVFormat.ja
 va</span></div><h1>CSVFormat.java</h1><pre class="source lang-java linenums">/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -20,6 +20,7 @@ package org.apache.commons.csv;
 import static org.apache.commons.csv.Constants.BACKSLASH;
 import static org.apache.commons.csv.Constants.COMMA;
 import static org.apache.commons.csv.Constants.COMMENT;
+import static org.apache.commons.csv.Constants.EMPTY;
 import static org.apache.commons.csv.Constants.CR;
 import static org.apache.commons.csv.Constants.CRLF;
 import static org.apache.commons.csv.Constants.DOUBLE_QUOTE_CHAR;
@@ -36,6 +37,7 @@ import java.io.Reader;
 import java.io.Serializable;
 import java.io.StringWriter;
 import java.nio.charset.Charset;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
@@ -150,8 +152,6 @@ import java.util.Set;
  * &lt;p&gt;
  * This class is immutable.
  * &lt;/p&gt;
- *
- * @version $Id$
  */
 public final class CSVFormat implements Serializable {
 
@@ -190,20 +190,31 @@ public final class CSVFormat implements
 <span class="fc" id="L190">        MySQL(CSVFormat.MYSQL),</span>
 
         /**
+         * @see CSVFormat#POSTGRESQL_CSV
+         * @since 1.5
+         */
+<span class="fc" id="L196">        PostgreSQLCsv(CSVFormat.POSTGRESQL_CSV),</span>
+
+        /**
+         * @see CSVFormat#POSTGRESQL_CSV
+         */
+<span class="fc" id="L201">        PostgreSQLText(CSVFormat.POSTGRESQL_TEXT),</span>
+
+        /**
          * @see CSVFormat#RFC4180
          */
-<span class="fc" id="L195">        RFC4180(CSVFormat.RFC4180),</span>
+<span class="fc" id="L206">        RFC4180(CSVFormat.RFC4180),</span>
 
         /**
          * @see CSVFormat#TDF
          */
-<span class="fc" id="L200">        TDF(CSVFormat.TDF);</span>
+<span class="fc" id="L211">        TDF(CSVFormat.TDF);</span>
 
         private final CSVFormat format;
 
-<span class="fc" id="L204">        Predefined(final CSVFormat format) {</span>
-<span class="fc" id="L205">            this.format = format;</span>
-<span class="fc" id="L206">        }</span>
+<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>
 
         /**
          * Gets the format.
@@ -211,7 +222,7 @@ public final class CSVFormat implements
          * @return the format.
          */
         public CSVFormat getFormat() {
-<span class="fc" id="L214">            return format;</span>
+<span class="fc" id="L225">            return format;</span>
         }
     }
 
@@ -230,7 +241,7 @@ public final class CSVFormat implements
      *
      * @see Predefined#Default
      */
-<span class="fc" id="L233">    public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true, CRLF,</span>
+<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);
 
     /**
@@ -262,7 +273,11 @@ public final class CSVFormat implements
      *
      * @see Predefined#Excel
      */
-<span class="fc" id="L265">    public static final CSVFormat EXCEL = DEFAULT.withIgnoreEmptyLines(false).withAllowMissingColumnNames();</span>
+    // @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>
+    // @formatter:on
 
     /**
      * Default Informix CSV UNLOAD format used by the {@code UNLOAD TO file_name} operation.
@@ -288,8 +303,13 @@ public final class CSVFormat implements
      *      http://www.ibm.com/support/knowledgecenter/SSBJG3_2.5.0/com.ibm.gen_busug.doc/c_fgl_InOutSql_UNLOAD.htm&lt;/a&gt;
      * @since 1.3
      */
-<span class="fc" id="L291">    public static final CSVFormat INFORMIX_UNLOAD = DEFAULT.withDelimiter(PIPE).withEscape(BACKSLASH)</span>
-<span class="fc" id="L292">            .withQuote(DOUBLE_QUOTE_CHAR).withRecordSeparator(LF);</span>
+    // @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>
+    // @formatter:on
 
     /**
      * Default Informix CSV UNLOAD format used by the {@code UNLOAD TO file_name} operation (escaping is disabled.)
@@ -314,8 +334,12 @@ public final class CSVFormat implements
      *      http://www.ibm.com/support/knowledgecenter/SSBJG3_2.5.0/com.ibm.gen_busug.doc/c_fgl_InOutSql_UNLOAD.htm&lt;/a&gt;
      * @since 1.3
      */
-<span class="fc" id="L317">    public static final CSVFormat INFORMIX_UNLOAD_CSV = DEFAULT.withDelimiter(COMMA).withQuote(DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L318">            .withRecordSeparator(LF);</span>
+    // @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>
+    // @formatter:on
 
     /**
      * Default MySQL format used by the {@code SELECT INTO OUTFILE} and {@code LOAD DATA INFILE} operations.
@@ -335,14 +359,97 @@ public final class CSVFormat implements
      * &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.ALL_NON_NULL)&lt;/li&gt;
+     * &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;
+     */
+    // @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>
+    // @formatter:off
+
+    /**
+     * Default PostgreSQL CSV format used by the {@code COPY} operation.
+     *
+     * &lt;p&gt;
+     * This is a comma-delimited format with a LF character as the line separator. Values are double quoted and special
+     * characters are escaped with {@code '&quot;'}. The default NULL string is {@code &quot;&quot;}.
+     * &lt;/p&gt;
+     *
+     * &lt;p&gt;
+     * Settings are:
+     * &lt;/p&gt;
+     * &lt;ul&gt;
+     * &lt;li&gt;withDelimiter(',')&lt;/li&gt;
+     * &lt;li&gt;withQuote('&quot;')&lt;/li&gt;
+     * &lt;li&gt;withRecordSeparator('\n')&lt;/li&gt;
+     * &lt;li&gt;withIgnoreEmptyLines(false)&lt;/li&gt;
+     * &lt;li&gt;withEscape('\\')&lt;/li&gt;
+     * &lt;li&gt;withNullString(&quot;&quot;)&lt;/li&gt;
+     * &lt;li&gt;withQuoteMode(QuoteMode.ALL_NON_NULL)&lt;/li&gt;
      * &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;
+     * @since 1.5
      */
-<span class="fc" id="L344">    public static final CSVFormat MYSQL = DEFAULT.withDelimiter(TAB).withEscape(BACKSLASH).withIgnoreEmptyLines(false)</span>
-<span class="fc" id="L345">            .withQuote(null).withRecordSeparator(LF).withNullString(&quot;\\N&quot;);</span>
+    // @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>
+    // @formatter:off
+
+    /**
+     * Default PostgreSQL text format used by the {@code COPY} operation.
+     *
+     * &lt;p&gt;
+     * This is a tab-delimited format with a LF character as the line separator. Values are double quoted and special
+     * characters are escaped with {@code '&quot;'}. The default NULL string is {@code &quot;\\N&quot;}.
+     * &lt;/p&gt;
+     *
+     * &lt;p&gt;
+     * Settings are:
+     * &lt;/p&gt;
+     * &lt;ul&gt;
+     * &lt;li&gt;withDelimiter('\t')&lt;/li&gt;
+     * &lt;li&gt;withQuote('&quot;')&lt;/li&gt;
+     * &lt;li&gt;withRecordSeparator('\n')&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.ALL_NON_NULL)&lt;/li&gt;
+     * &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;
+     * @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>
+    // @formatter:off
 
     /**
      * Comma separated format as defined by &lt;a href=&quot;http://tools.ietf.org/html/rfc4180&quot;&gt;RFC 4180&lt;/a&gt;.
@@ -359,7 +466,7 @@ public final class CSVFormat implements
      *
      * @see Predefined#RFC4180
      */
-<span class="fc" id="L362">    public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false);</span>
+<span class="fc" id="L469">    public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false);</span>
 
     private static final long serialVersionUID = 1L;
 
@@ -378,7 +485,11 @@ public final class CSVFormat implements
      *
      * @see Predefined#TDF
      */
-<span class="fc" id="L381">    public static final CSVFormat TDF = DEFAULT.withDelimiter(TAB).withIgnoreSurroundingSpaces();</span>
+    // @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>
+    // @formatter:on
 
     /**
      * Returns true if the given character is a line break character.
@@ -389,7 +500,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="L392" title="All 4 branches covered.">        return c == LF || c == CR;</span>
+<span class="fc bfc" id="L503" title="All 4 branches covered.">        return c == LF || c == CR;</span>
     }
 
     /**
@@ -401,7 +512,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="L404" title="All 4 branches covered.">        return c != null &amp;&amp; isLineBreak(c.charValue());</span>
+<span class="fc bfc" id="L515" title="All 4 branches covered.">        return c != null &amp;&amp; isLineBreak(c.charValue());</span>
     }
 
     /**
@@ -425,7 +536,7 @@ public final class CSVFormat implements
      * @see #TDF
      */
     public static CSVFormat newFormat(final char delimiter) {
-<span class="fc" id="L428">        return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false,</span>
+<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);
     }
 
@@ -438,7 +549,7 @@ public final class CSVFormat implements
      * @since 1.2
      */
     public static CSVFormat valueOf(final String format) {
-<span class="fc" id="L441">        return CSVFormat.Predefined.valueOf(format).getFormat();</span>
+<span class="fc" id="L552">        return CSVFormat.Predefined.valueOf(format).getFormat();</span>
     }
 
     private final boolean allowMissingColumnNames;
@@ -516,93 +627,93 @@ public final class CSVFormat implements
             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="L519">            final boolean trailingDelimiter) {</span>
-<span class="fc" id="L520">        this.delimiter = delimiter;</span>
-<span class="fc" id="L521">        this.quoteCharacter = quoteChar;</span>
-<span class="fc" id="L522">        this.quoteMode = quoteMode;</span>
-<span class="fc" id="L523">        this.commentMarker = commentStart;</span>
-<span class="fc" id="L524">        this.escapeCharacter = escape;</span>
-<span class="fc" id="L525">        this.ignoreSurroundingSpaces = ignoreSurroundingSpaces;</span>
-<span class="fc" id="L526">        this.allowMissingColumnNames = allowMissingColumnNames;</span>
-<span class="fc" id="L527">        this.ignoreEmptyLines = ignoreEmptyLines;</span>
-<span class="fc" id="L528">        this.recordSeparator = recordSeparator;</span>
-<span class="fc" id="L529">        this.nullString = nullString;</span>
-<span class="fc" id="L530">        this.headerComments = toStringArray(headerComments);</span>
-<span class="fc bfc" id="L531" title="All 2 branches covered.">        this.header = header == null ? null : header.clone();</span>
-<span class="fc" id="L532">        this.skipHeaderRecord = skipHeaderRecord;</span>
-<span class="fc" id="L533">        this.ignoreHeaderCase = ignoreHeaderCase;</span>
-<span class="fc" id="L534">        this.trailingDelimiter = trailingDelimiter;</span>
-<span class="fc" id="L535">        this.trim = trim;</span>
-<span class="fc" id="L536">        validate();</span>
-<span class="fc" id="L537">    }</span>
+<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>
 
     @Override
     public boolean equals(final Object obj) {
-<span class="fc bfc" id="L541" title="All 2 branches covered.">        if (this == obj) {</span>
-<span class="fc" id="L542">            return true;</span>
+<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="L544" title="All 2 branches covered.">        if (obj == null) {</span>
-<span class="fc" id="L545">            return false;</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="L547" title="All 2 branches covered.">        if (getClass() != obj.getClass()) {</span>
-<span class="fc" id="L548">            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" id="L551">        final CSVFormat other = (CSVFormat) obj;</span>
-<span class="fc bfc" id="L552" title="All 2 branches covered.">        if (delimiter != other.delimiter) {</span>
-<span class="fc" id="L553">            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 bfc" id="L555" title="All 2 branches covered.">        if (quoteMode != other.quoteMode) {</span>
-<span class="fc" id="L556">            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="L558" title="All 2 branches covered.">        if (quoteCharacter == null) {</span>
-<span class="fc bfc" id="L559" title="All 2 branches covered.">            if (other.quoteCharacter != null) {</span>
-<span class="fc" id="L560">                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="L562" title="All 2 branches covered.">        } else if (!quoteCharacter.equals(other.quoteCharacter)) {</span>
-<span class="fc" id="L563">            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="L565" title="All 2 branches covered.">        if (commentMarker == null) {</span>
-<span class="pc bpc" id="L566" title="1 of 2 branches missed.">            if (other.commentMarker != null) {</span>
-<span class="nc" id="L567">                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="L569" title="All 2 branches covered.">        } else if (!commentMarker.equals(other.commentMarker)) {</span>
-<span class="fc" id="L570">            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="L572" title="All 2 branches covered.">        if (escapeCharacter == null) {</span>
-<span class="pc bpc" id="L573" title="1 of 2 branches missed.">            if (other.escapeCharacter != null) {</span>
-<span class="nc" id="L574">                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="L576" title="All 2 branches covered.">        } else if (!escapeCharacter.equals(other.escapeCharacter)) {</span>
-<span class="fc" id="L577">            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="L579" title="All 2 branches covered.">        if (nullString == null) {</span>
-<span class="pc bpc" id="L580" title="1 of 2 branches missed.">            if (other.nullString != null) {</span>
-<span class="nc" id="L581">                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="L583" title="All 2 branches covered.">        } else if (!nullString.equals(other.nullString)) {</span>
-<span class="fc" id="L584">            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="L586" title="All 2 branches covered.">        if (!Arrays.equals(header, other.header)) {</span>
-<span class="fc" id="L587">            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="L589" title="All 2 branches covered.">        if (ignoreSurroundingSpaces != other.ignoreSurroundingSpaces) {</span>
-<span class="fc" id="L590">            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="L592" title="All 2 branches covered.">        if (ignoreEmptyLines != other.ignoreEmptyLines) {</span>
-<span class="fc" id="L593">            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="L595" title="All 2 branches covered.">        if (skipHeaderRecord != other.skipHeaderRecord) {</span>
-<span class="fc" id="L596">            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="L598" title="All 2 branches covered.">        if (recordSeparator == null) {</span>
-<span class="pc bpc" id="L599" title="1 of 2 branches missed.">            if (other.recordSeparator != null) {</span>
-<span class="nc" id="L600">                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="L602" title="All 2 branches covered.">        } else if (!recordSeparator.equals(other.recordSeparator)) {</span>
-<span class="fc" id="L603">            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" id="L605">        return true;</span>
+<span class="fc" id="L716">        return true;</span>
     }
 
     /**
@@ -613,13 +724,13 @@ public final class CSVFormat implements
      * @return the formatted values
      */
     public String format(final Object... values) {
-<span class="fc" id="L616">        final StringWriter out = new StringWriter();</span>
-<span class="pc" id="L617">        try (final CSVPrinter csvPrinter = new CSVPrinter(out, this)) {</span>
-<span class="fc" id="L618">            csvPrinter.printRecord(values);</span>
-<span class="fc" id="L619">            return out.toString().trim();</span>
-<span class="pc bpc" id="L620" title="6 of 8 branches missed.">        } catch (final IOException e) {</span>
+<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>
             // should not happen because a StringWriter does not do IO.
-<span class="nc" id="L622">            throw new IllegalStateException(e);</span>
+<span class="nc" id="L733">            throw new IllegalStateException(e);</span>
         }
     }
 
@@ -630,7 +741,7 @@ public final class CSVFormat implements
      *         {@link IllegalArgumentException}.
      */
     public boolean getAllowMissingColumnNames() {
-<span class="fc" id="L633">        return allowMissingColumnNames;</span>
+<span class="fc" id="L744">        return allowMissingColumnNames;</span>
     }
 
     /**
@@ -639,7 +750,7 @@ public final class CSVFormat implements
      * @return the comment start marker, may be {@code null}
      */
     public Character getCommentMarker() {
-<span class="fc" id="L642">        return commentMarker;</span>
+<span class="fc" id="L753">        return commentMarker;</span>
     }
 
     /**
@@ -648,7 +759,7 @@ public final class CSVFormat implements
      * @return the delimiter character
      */
     public char getDelimiter() {
-<span class="fc" id="L651">        return delimiter;</span>
+<span class="fc" id="L762">        return delimiter;</span>
     }
 
     /**
@@ -657,7 +768,7 @@ public final class CSVFormat implements
      * @return the escape character, may be {@code null}
      */
     public Character getEscapeCharacter() {
-<span class="fc" id="L660">        return escapeCharacter;</span>
+<span class="fc" id="L771">        return escapeCharacter;</span>
     }
 
     /**
@@ -666,7 +777,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="L669" title="All 2 branches covered.">        return header != null ? header.clone() : null;</span>
+<span class="fc bfc" id="L780" title="All 2 branches covered.">        return header != null ? header.clone() : null;</span>
     }
 
     /**
@@ -675,7 +786,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="L678" title="All 2 branches covered.">        return headerComments != null ? headerComments.clone() : null;</span>
+<span class="fc bfc" id="L789" title="All 2 branches covered.">        return headerComments != null ? headerComments.clone() : null;</span>
     }
 
     /**
@@ -685,7 +796,7 @@ public final class CSVFormat implements
      *         records.
      */
     public boolean getIgnoreEmptyLines() {
-<span class="fc" id="L688">        return ignoreEmptyLines;</span>
+<span class="fc" id="L799">        return ignoreEmptyLines;</span>
     }
 
     /**
@@ -695,7 +806,7 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public boolean getIgnoreHeaderCase() {
-<span class="fc" id="L698">        return ignoreHeaderCase;</span>
+<span class="fc" id="L809">        return ignoreHeaderCase;</span>
     }
 
     /**
@@ -704,7 +815,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="L707">        return ignoreSurroundingSpaces;</span>
+<span class="fc" id="L818">        return ignoreSurroundingSpaces;</span>
     }
 
     /**
@@ -718,7 +829,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="L721">        return nullString;</span>
+<span class="fc" id="L832">        return nullString;</span>
     }
 
     /**
@@ -727,7 +838,7 @@ public final class CSVFormat implements
      * @return the quoteChar character, may be {@code null}
      */
     public Character getQuoteCharacter() {
-<span class="fc" id="L730">        return quoteCharacter;</span>
+<span class="fc" id="L841">        return quoteCharacter;</span>
     }
 
     /**
@@ -736,7 +847,7 @@ public final class CSVFormat implements
      * @return the quote policy
      */
     public QuoteMode getQuoteMode() {
-<span class="fc" id="L739">        return quoteMode;</span>
+<span class="fc" id="L850">        return quoteMode;</span>
     }
 
     /**
@@ -745,7 +856,7 @@ public final class CSVFormat implements
      * @return the record separator
      */
     public String getRecordSeparator() {
-<span class="fc" id="L748">        return recordSeparator;</span>
+<span class="fc" id="L859">        return recordSeparator;</span>
     }
 
     /**
@@ -754,7 +865,7 @@ public final class CSVFormat implements
      * @return whether to skip the header record.
      */
     public boolean getSkipHeaderRecord() {
-<span class="fc" id="L757">        return skipHeaderRecord;</span>
+<span class="fc" id="L868">        return skipHeaderRecord;</span>
     }
 
     /**
@@ -764,7 +875,7 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public boolean getTrailingDelimiter() {
-<span class="fc" id="L767">        return trailingDelimiter;</span>
+<span class="fc" id="L878">        return trailingDelimiter;</span>
     }
 
     /**
@@ -773,27 +884,27 @@ public final class CSVFormat implements
      * @return whether to trim leading and trailing blanks.
      */
     public boolean getTrim() {
-<span class="fc" id="L776">        return trim;</span>
+<span class="fc" id="L887">        return trim;</span>
     }
 
     @Override
     public int hashCode() {
-<span class="fc" id="L781">        final int prime = 31;</span>
-<span class="fc" id="L782">        int result = 1;</span>
+<span class="fc" id="L892">        final int prime = 31;</span>
+<span class="fc" id="L893">        int result = 1;</span>
 
-<span class="fc" id="L784">        result = prime * result + delimiter;</span>
-<span class="pc bpc" id="L785" title="1 of 2 branches missed.">        result = prime * result + ((quoteMode == null) ? 0 : quoteMode.hashCode());</span>
-<span class="pc bpc" id="L786" title="1 of 2 branches missed.">        result = prime * result + ((quoteCharacter == null) ? 0 : quoteCharacter.hashCode());</span>
-<span class="pc bpc" id="L787" title="1 of 2 branches missed.">        result = prime * result + ((commentMarker == null) ? 0 : commentMarker.hashCode());</span>
-<span class="pc bpc" id="L788" title="1 of 2 branches missed.">        result = prime * result + ((escapeCharacter == null) ? 0 : escapeCharacter.hashCode());</span>
-<span class="pc bpc" id="L789" title="1 of 2 branches missed.">        result = prime * result + ((nullString == null) ? 0 : nullString.hashCode());</span>
-<span class="pc bpc" id="L790" title="1 of 2 branches missed.">        result = prime * result + (ignoreSurroundingSpaces ? 1231 : 1237);</span>
-<span class="pc bpc" id="L791" title="1 of 2 branches missed.">        result = prime * result + (ignoreHeaderCase ? 1231 : 1237);</span>
-<span class="pc bpc" id="L792" title="1 of 2 branches missed.">        result = prime * result + (ignoreEmptyLines ? 1231 : 1237);</span>
-<span class="pc bpc" id="L793" title="1 of 2 branches missed.">        result = prime * result + (skipHeaderRecord ? 1231 : 1237);</span>
-<span class="pc bpc" id="L794" title="1 of 2 branches missed.">        result = prime * result + ((recordSeparator == null) ? 0 : recordSeparator.hashCode());</span>
-<span class="fc" id="L795">        result = prime * result + Arrays.hashCode(header);</span>
-<span class="fc" id="L796">        return result;</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>
     }
 
     /**
@@ -804,7 +915,7 @@ public final class CSVFormat implements
      * @return {@code true} is comments are supported, {@code false} otherwise
      */
     public boolean isCommentMarkerSet() {
-<span class="fc bfc" id="L807" title="All 2 branches covered.">        return commentMarker != null;</span>
+<span class="fc bfc" id="L918" title="All 2 branches covered.">        return commentMarker != null;</span>
     }
 
     /**
@@ -813,7 +924,7 @@ public final class CSVFormat implements
      * @return {@code true} if escapes are processed
      */
     public boolean isEscapeCharacterSet() {
-<span class="fc bfc" id="L816" title="All 2 branches covered.">        return escapeCharacter != null;</span>
+<span class="fc bfc" id="L927" title="All 2 branches covered.">        return escapeCharacter != null;</span>
     }
 
     /**
@@ -822,7 +933,7 @@ public final class CSVFormat implements
      * @return {@code true} if a nullString is defined
      */
     public boolean isNullStringSet() {
-<span class="pc bpc" id="L825" title="1 of 2 branches missed.">        return nullString != null;</span>
+<span class="fc bfc" id="L936" title="All 2 branches covered.">        return nullString != null;</span>
     }
 
     /**
@@ -831,7 +942,7 @@ public final class CSVFormat implements
      * @return {@code true} if a quoteChar is defined
      */
     public boolean isQuoteCharacterSet() {
-<span class="fc bfc" id="L834" title="All 2 branches covered.">        return quoteCharacter != null;</span>
+<span class="fc bfc" id="L945" title="All 2 branches covered.">        return quoteCharacter != null;</span>
     }
 
     /**
@@ -848,7 +959,7 @@ public final class CSVFormat implements
      *             If an I/O error occurs
      */
     public CSVParser parse(final Reader in) throws IOException {
-<span class="fc" id="L851">        return new CSVParser(in, this);</span>
+<span class="fc" id="L962">        return new CSVParser(in, this);</span>
     }
 
     /**
@@ -859,13 +970,29 @@ public final class CSVFormat implements
      * &lt;/p&gt;
      *
      * @param out
-     *            the output
-     * @return a printer to an output
+     *            the output.
+     * @return a printer to an output.
      * @throws IOException
      *             thrown if the optional header cannot be printed.
      */
     public CSVPrinter print(final Appendable out) throws IOException {
-<span class="fc" id="L868">        return new CSVPrinter(out, this);</span>
+<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>
     }
 
     /**
@@ -876,17 +1003,18 @@ public final class CSVFormat implements
      * &lt;/p&gt;
      *
      * @param out
-     *            the output
-     * @param charset 
-     *            A charset
-     * @return a printer to an output
+     *            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
      */
+    @SuppressWarnings(&quot;resource&quot;)
     public CSVPrinter print(final File out, Charset charset) throws IOException {
         // The writer will be closed when close() is called.
-<span class="fc" id="L889">        return new CSVPrinter(new OutputStreamWriter(new FileOutputStream(out), charset), this);</span>
+<span class="fc" id="L1017">        return new CSVPrinter(new OutputStreamWriter(new FileOutputStream(out), charset), this);</span>
     }
 
     /**
@@ -897,16 +1025,16 @@ public final class CSVFormat implements
      * &lt;/p&gt;
      *
      * @param out
-     *            the output
-     * @param charset 
-     *            A charset
-     * @return a printer to an output
+     *            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="L909">        return print(out.toFile(), charset);</span>
+<span class="fc" id="L1037">        return print(Files.newBufferedWriter(out, charset));</span>
     }
 
     /**
@@ -916,82 +1044,91 @@ public final class CSVFormat implements
      * @param value
      *            value to output.
      * @param out
-     *            where to print the value
+     *            where to print the value.
      * @param newRecord
-     *            if this a new record
+     *            if this a new record.
      * @throws IOException
-     *             If an I/O error occurs
+     *             If an I/O error occurs.
      * @since 1.4
      */
     public void print(final Object value, final Appendable out, final boolean newRecord) throws IOException {
         // 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="L930" title="All 2 branches covered.">        if (value == null) {</span>
-<span class="fc bfc" id="L931" title="All 2 branches covered.">            charSequence = nullString == null ? Constants.EMPTY : nullString;</span>
+<span class="fc bfc" id="L1058" 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>
+            } 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>
+                } else {
+<span class="fc" id="L1066">                    charSequence = nullString;</span>
+                }
+            }
         } else {
-<span class="fc bfc" id="L933" title="All 2 branches covered.">            charSequence = value instanceof CharSequence ? (CharSequence) value : value.toString();</span>
+<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="L935" title="All 2 branches covered.">        charSequence = getTrim() ? trim(charSequence) : charSequence;</span>
-<span class="fc" id="L936">        this.print(value, charSequence, 0, charSequence.length(), out, newRecord);</span>
-<span class="fc" id="L937">    }</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>
 
     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="L941" title="All 2 branches covered.">        if (!newRecord) {</span>
-<span class="fc" id="L942">            out.append(getDelimiter());</span>
+<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="L944" title="All 2 branches covered.">        if (object == null) {</span>
-<span class="fc" id="L945">            out.append(value);</span>
-<span class="fc bfc" id="L946" title="All 2 branches covered.">        } else if (isQuoteCharacterSet()) {</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>
             // the original object is needed so can check for Number
-<span class="fc" id="L948">            printAndQuote(object, value, offset, len, out, newRecord);</span>
-<span class="fc bfc" id="L949" title="All 2 branches covered.">        } else if (isEscapeCharacterSet()) {</span>
-<span class="fc" id="L950">            printAndEscape(value, offset, len, out);</span>
+<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>
         } else {
-<span class="fc" id="L952">            out.append(value, offset, offset + len);</span>
+<span class="fc" id="L1089">            out.append(value, offset, offset + len);</span>
         }
-<span class="fc" id="L954">    }</span>
+<span class="fc" id="L1091">    }</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="L961">        int start = offset;</span>
-<span class="fc" id="L962">        int pos = offset;</span>
-<span class="fc" id="L963">        final int end = offset + len;</span>
-
-<span class="fc" id="L965">        final char delim = getDelimiter();</span>
-<span class="fc" id="L966">        final char escape = getEscapeCharacter().charValue();</span>
-
-<span class="fc bfc" id="L968" title="All 2 branches covered.">        while (pos &lt; end) {</span>
-<span class="fc" id="L969">            char c = value.charAt(pos);</span>
-<span class="fc bfc" id="L970" title="All 8 branches covered.">            if (c == CR || c == LF || c == delim || c == escape) {</span>
+<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>
                 // write out segment up until this char
-<span class="fc bfc" id="L972" title="All 2 branches covered.">                if (pos &gt; start) {</span>
-<span class="fc" id="L973">                    out.append(value, start, pos);</span>
+<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="L975" title="All 2 branches covered.">                if (c == LF) {</span>
-<span class="fc" id="L976">                    c = 'n';</span>
-<span class="fc bfc" id="L977" title="All 2 branches covered.">                } else if (c == CR) {</span>
-<span class="fc" id="L978">                    c = 'r';</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" id="L981">                out.append(escape);</span>
-<span class="fc" id="L982">                out.append(c);</span>
+<span class="fc" id="L1118">                out.append(escape);</span>
+<span class="fc" id="L1119">                out.append(c);</span>
 
-<span class="fc" id="L984">                start = pos + 1; // start on the current char after this one</span>
+<span class="fc" id="L1121">                start = pos + 1; // start on the current char after this one</span>
             }
 
-<span class="fc" id="L987">            pos++;</span>
-<span class="fc" id="L988">        }</span>
+<span class="fc" id="L1124">            pos++;</span>
+<span class="fc" id="L1125">        }</span>
 
         // write last segment
-<span class="fc bfc" id="L991" title="All 2 branches covered.">        if (pos &gt; start) {</span>
-<span class="fc" id="L992">            out.append(value, start, pos);</span>
+<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" id="L994">    }</span>
+<span class="fc" id="L1131">    }</span>
 
     /*
      * Note: must only be called if quoting is enabled, otherwise will generate NPE
@@ -999,113 +1136,114 @@ 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="L1002">        boolean quote = false;</span>
-<span class="fc" id="L1003">        int start = offset;</span>
-<span class="fc" id="L1004">        int pos = offset;</span>
-<span class="fc" id="L1005">        final int end = offset + len;</span>
-
-<span class="fc" id="L1007">        final char delimChar = getDelimiter();</span>
-<span class="fc" id="L1008">        final char quoteChar = getQuoteCharacter().charValue();</span>
-
-<span class="fc" id="L1010">        QuoteMode quoteModePolicy = getQuoteMode();</span>
-<span class="fc bfc" id="L1011" title="All 2 branches covered.">        if (quoteModePolicy == null) {</span>
-<span class="fc" id="L1012">            quoteModePolicy = QuoteMode.MINIMAL;</span>
+<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="pc bpc" id="L1014" title="1 of 5 branches missed.">        switch (quoteModePolicy) {</span>
+<span class="pc bpc" id="L1151" title="1 of 5 branches missed.">        switch (quoteModePolicy) {</span>
         case ALL:
-<span class="fc" id="L1016">            quote = true;</span>
-<span class="fc" id="L1017">            break;</span>
+        case ALL_NON_NULL:
+<span class="fc" id="L1154">            quote = true;</span>
+<span class="fc" id="L1155">            break;</span>
         case NON_NUMERIC:
-<span class="fc bfc" id="L1019" title="All 2 branches covered.">            quote = !(object instanceof Number);</span>
-<span class="fc" id="L1020">            break;</span>
+<span class="fc bfc" id="L1157" title="All 2 branches covered.">            quote = !(object instanceof Number);</span>
+<span class="fc" id="L1158">            break;</span>
         case NONE:
             // Use the existing escaping code
-<span class="fc" id="L1023">            printAndEscape(value, offset, len, out);</span>
-<span class="fc" id="L1024">            return;</span>
+<span class="fc" id="L1161">            printAndEscape(value, offset, len, out);</span>
+<span class="fc" id="L1162">            return;</span>
         case MINIMAL:
-<span class="fc bfc" id="L1026" title="All 2 branches covered.">            if (len &lt;= 0) {</span>
+<span class="fc bfc" id="L1164" 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="L1031" title="All 2 branches covered.">                if (newRecord) {</span>
-<span class="fc" id="L1032">                    quote = true;</span>
+<span class="fc bfc" id="L1169" title="All 2 branches covered.">                if (newRecord) {</span>
+<span class="fc" id="L1170">                    quote = true;</span>
                 }
             } else {
-<span class="fc" id="L1035">                char c = value.charAt(pos);</span>
+<span class="fc" id="L1173">                char c = value.charAt(pos);</span>
 
-                // TODO where did this rule come from?
-<span class="fc bfc" id="L1038" title="All 14 branches covered.">                if (newRecord &amp;&amp; (c &lt; '0' || c &gt; '9' &amp;&amp; c &lt; 'A' || c &gt; 'Z' &amp;&amp; c &lt; 'a' || c &gt; 'z')) {</span>
-<span class="fc" id="L1039">                    quote = true;</span>
-<span class="fc bfc" id="L1040" title="All 2 branches covered.">                } else if (c &lt;= COMMENT) {</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>
                     // 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="L1044">                    quote = true;</span>
+<span class="fc" id="L1182">                    quote = true;</span>
                 } else {
-<span class="fc bfc" id="L1046" title="All 2 branches covered.">                    while (pos &lt; end) {</span>
-<span class="fc" id="L1047">                        c = value.charAt(pos);</span>
-<span class="fc bfc" id="L1048" title="All 8 branches covered.">                        if (c == LF || c == CR || c == quoteChar || c == delimChar) {</span>
-<span class="fc" id="L1049">                            quote = true;</span>
-<span class="fc" id="L1050">                            break;</span>
+<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" id="L1052">                        pos++;</span>
+<span class="fc" id="L1190">                        pos++;</span>
                     }
 
-<span class="fc bfc" id="L1055" title="All 2 branches covered.">                    if (!quote) {</span>
-<span class="fc" id="L1056">                        pos = end - 1;</span>
-<span class="fc" id="L1057">                        c = value.charAt(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>
                         // 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="L1060" title="All 2 branches covered.">                        if (c &lt;= SP) {</span>
-<span class="fc" id="L1061">                            quote = true;</span>
+<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="L1067" title="All 2 branches covered.">            if (!quote) {</span>
+<span class="fc bfc" id="L1205" title="All 2 branches covered.">            if (!quote) {</span>
                 // no encapsulation needed - write out the original value
-<span class="fc" id="L1069">                out.append(value, start, end);</span>
-<span class="fc" id="L1070">                return;</span>
+<span class="fc" id="L1207">                out.append(value, start, end);</span>
+<span class="fc" id="L1208">                return;</span>
             }
             break;
         default:
-<span class="nc" id="L1074">            throw new IllegalStateException(&quot;Unexpected Quote value: &quot; + quoteModePolicy);</span>
+<span class="nc" id="L1212">            throw new IllegalStateException(&quot;Unexpected Quote value: &quot; + quoteModePolicy);</span>
         }
 
-<span class="fc bfc" id="L1077" title="All 2 branches covered.">        if (!quote) {</span>
+<span class="fc bfc" id="L1215" title="All 2 branches covered.">        if (!quote) {</span>
             // no encapsulation needed - write out the original value
-<span class="fc" id="L1079">            out.append(value, start, end);</span>
-<span class="fc" id="L1080">            return;</span>
+<span class="fc" id="L1217">            out.append(value, start, end);</span>
+<span class="fc" id="L1218">            return;</span>
         }
 
         // we hit something that needed encapsulation
-<span class="fc" id="L1084">        out.append(quoteChar);</span>
+<span class="fc" id="L1222">        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="L1088" title="All 2 branches covered.">        while (pos &lt; end) {</span>
-<span class="fc" id="L1089">            final char c = value.charAt(pos);</span>
-<span class="fc bfc" id="L1090" title="All 2 branches covered.">            if (c == quoteChar) {</span>
+<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>
                 // write out the chunk up until this point
 
                 // add 1 to the length to write out the encapsulator also
-<span class="fc" id="L1094">                out.append(value, start, pos + 1);</span>
+<span class="fc" id="L1232">                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="L1097">                start = pos;</span>
+<span class="fc" id="L1235">                start = pos;</span>
             }
-<span class="fc" id="L1099">            pos++;</span>
-<span class="fc" id="L1100">        }</span>
+<span class="fc" id="L1237">            pos++;</span>
+<span class="fc" id="L1238">        }</span>
 
         // write the last segment
-<span class="fc" id="L1103">        out.append(value, start, pos);</span>
-<span class="fc" id="L1104">        out.append(quoteChar);</span>
-<span class="fc" id="L1105">    }</span>
+<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>
 
     /**
-     * Outputs the record separator.
+     * Outputs the trailing delimiter (if set) followed by the record separator (if set).
      *
      * @param out
      *            where to write
@@ -1114,13 +1252,13 @@ public final class CSVFormat implements
      * @since 1.4
      */
     public void println(final Appendable out) throws IOException {
-<span class="fc bfc" id="L1117" title="All 2 branches covered.">        if (getTrailingDelimiter()) {</span>
-<span class="fc" id="L1118">            out.append(getDelimiter());</span>
+<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="L1120" title="All 2 branches covered.">        if (recordSeparator != null) {</span>
-<span class="fc" id="L1121">            out.append(recordSeparator);</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" id="L1123">    }</span>
+<span class="fc" id="L1261">    }</span>
 
     /**
      * Prints the given {@code values} to {@code out} as a single record of delimiter separated values followed by the
@@ -1132,92 +1270,92 @@ public final class CSVFormat implements
      * &lt;/p&gt;
      *
      * @param out
-     *            where to write
+     *            where to write.
      * @param values
      *            values to output.
      * @throws IOException
-     *             If an I/O error occurs
+     *             If an I/O error occurs.
      * @since 1.4
      */
     public void printRecord(final Appendable out, final Object... values) throws IOException {
-<span class="fc bfc" id="L1143" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
-<span class="fc bfc" id="L1144" title="All 2 branches covered.">            print(values[i], out, i == 0);</span>
+<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" id="L1146">        println(out);</span>
-<span class="fc" id="L1147">    }</span>
+<span class="fc" id="L1284">        println(out);</span>
+<span class="fc" id="L1285">    }</span>
 
     @Override
     public String toString() {
-<span class="fc" id="L1151">        final StringBuilder sb = new StringBuilder();</span>
-<span class="fc" id="L1152">        sb.append(&quot;Delimiter=&lt;&quot;).append(delimiter).append('&gt;');</span>
-<span class="pc bpc" id="L1153" title="1 of 2 branches missed.">        if (isEscapeCharacterSet()) {</span>
-<span class="nc" id="L1154">            sb.append(' ');</span>
-<span class="nc" id="L1155">            sb.append(&quot;Escape=&lt;&quot;).append(escapeCharacter).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L1157" title="1 of 2 branches missed.">        if (isQuoteCharacterSet()) {</span>
-<span class="fc" id="L1158">            sb.append(' ');</span>
-<span class="fc" id="L1159">            sb.append(&quot;QuoteChar=&lt;&quot;).append(quoteCharacter).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L1161" title="All 2 branches covered.">        if (isCommentMarkerSet()) {</span>
-<span class="fc" id="L1162">            sb.append(' ');</span>
-<span class="fc" id="L1163">            sb.append(&quot;CommentStart=&lt;&quot;).append(commentMarker).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L1165" title="1 of 2 branches missed.">        if (isNullStringSet()) {</span>
-<span class="nc" id="L1166">            sb.append(' ');</span>
-<span class="nc" id="L1167">            sb.append(&quot;NullString=&lt;&quot;).append(nullString).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L1169" title="1 of 2 branches missed.">        if (recordSeparator != null) {</span>
-<span class="nc" id="L1170">            sb.append(' ');</span>
-<span class="nc" id="L1171">            sb.append(&quot;RecordSeparator=&lt;&quot;).append(recordSeparator).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L1173" title="All 2 branches covered.">        if (getIgnoreEmptyLines()) {</span>
-<span class="fc" id="L1174">            sb.append(&quot; EmptyLines:ignored&quot;);</span>
-        }
-<span class="fc bfc" id="L1176" title="All 2 branches covered.">        if (getIgnoreSurroundingSpaces()) {</span>
-<span class="fc" id="L1177">            sb.append(&quot; SurroundingSpaces:ignored&quot;);</span>
-        }
-<span class="pc bpc" id="L1179" title="1 of 2 branches missed.">        if (getIgnoreHeaderCase()) {</span>
-<span class="nc" id="L1180">            sb.append(&quot; IgnoreHeaderCase:ignored&quot;);</span>
-        }
-<span class="fc" id="L1182">        sb.append(&quot; SkipHeaderRecord:&quot;).append(skipHeaderRecord);</span>
-<span class="pc bpc" id="L1183" title="1 of 2 branches missed.">        if (headerComments != null) {</span>
-<span class="nc" id="L1184">            sb.append(' ');</span>
-<span class="nc" id="L1185">            sb.append(&quot;HeaderComments:&quot;).append(Arrays.toString(headerComments));</span>
-        }
-<span class="pc bpc" id="L1187" title="1 of 2 branches missed.">        if (header != null) {</span>
-<span class="nc" id="L1188">            sb.append(' ');</span>
-<span class="nc" id="L1189">            sb.append(&quot;Header:&quot;).append(Arrays.toString(header));</span>
+<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="L1191">        return sb.toString();</span>
+<span class="fc" id="L1329">        return sb.toString();</span>
     }
 
     private String[] toStringArray(final Object[] values) {
-<span class="fc bfc" id="L1195" title="All 2 branches covered.">        if (values == null) {</span>
-<span class="fc" id="L1196">            return null;</span>
+<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" id="L1198">        final String[] strings = new String[values.length];</span>
-<span class="fc bfc" id="L1199" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
-<span class="fc" id="L1200">            final Object value = values[i];</span>
-<span class="pc bpc" id="L1201" title="1 of 2 branches missed.">            strings[i] = value == null ? null : value.toString();</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="L1203">        return strings;</span>
+<span class="fc" id="L1341">        return strings;</span>
     }
 
     private CharSequence trim(final CharSequence charSequence) {
-<span class="pc bpc" id="L1207" title="1 of 2 branches missed.">        if (charSequence instanceof String) {</span>
-<span class="fc" id="L1208">            return ((String) charSequence).trim();</span>
+<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="nc" id="L1210">        final int count = charSequence.length();</span>
-<span class="nc" id="L1211">        int len = count;</span>
-<span class="nc" id="L1212">        int pos = 0;</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 bnc" id="L1214" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(pos) &lt;= SP) {</span>
-<span class="nc" id="L1215">            pos++;</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="L1217" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(len - 1) &lt;= SP) {</span>
-<span class="nc" id="L1218">            len--;</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="L1220" title="All 4 branches missed.">        return pos &gt; 0 || len &lt; count ? charSequence.subSequence(pos, len) : charSequence;</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>
     }
 
     /**
@@ -1226,50 +1364,50 @@ public final class CSVFormat implements
      * @throws IllegalArgumentException
      */
     private void validate() throws IllegalArgumentException {
-<span class="pc bpc" id="L1229" title="1 of 2 branches missed.">        if (isLineBreak(delimiter)) {</span>
-<span class="nc" id="L1230">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
+<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="fc bfc" id="L1233" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; delimiter == quoteCharacter.charValue()) {</span>
-<span class="fc" id="L1234">            throw new IllegalArgumentException(</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>
                     &quot;The quoteChar character and the delimiter cannot be the same ('&quot; + quoteCharacter + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1238" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; delimiter == escapeCharacter.charValue()) {</span>
-<span class="fc" id="L1239">            throw new IllegalArgumentException(</span>
+<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>
                     &quot;The escape character and the delimiter cannot be the same ('&quot; + escapeCharacter + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1243" title="All 4 branches covered.">        if (commentMarker != null &amp;&amp; delimiter == commentMarker.charValue()) {</span>
-<span class="fc" id="L1244">            throw new IllegalArgumentException(</span>
+<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>
                     &quot;The comment start character and the delimiter cannot be the same ('&quot; + commentMarker + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1248" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; quoteCharacter.equals(commentMarker)) {</span>
-<span class="fc" id="L1249">            throw new IllegalArgumentException(</span>
+<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>
                     &quot;The comment start character and the quoteChar cannot be the same ('&quot; + commentMarker + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1253" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; escapeCharacter.equals(commentMarker)) {</span>
-<span class="fc" id="L1254">            throw new IllegalArgumentException(</span>
+<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>
                     &quot;The comment start and the escape character cannot be the same ('&quot; + commentMarker + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1258" title="All 4 branches covered.">        if (escapeCharacter == null &amp;&amp; quoteMode == QuoteMode.NONE) {</span>
-<span class="fc" id="L1259">            throw new IllegalArgumentException(&quot;No quotes mode set but no escape character is set&quot;);</span>
+<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>
         }
 
         // validate header
-<span class="fc bfc" id="L1263" title="All 2 branches covered.">        if (header != null) {</span>
-<span class="fc" id="L1264">            final Set&lt;String&gt; dupCheck = new HashSet&lt;&gt;();</span>
-<span class="fc bfc" id="L1265" title="All 2 branches covered.">            for (final String hdr : header) {</span>
-<span class="fc bfc" id="L1266" title="All 2 branches covered.">                if (!dupCheck.add(hdr)) {</span>
-<span class="fc" id="L1267">                    throw new IllegalArgumentException(</span>
-<span class="fc" id="L1268">                            &quot;The header contains a duplicate entry: '&quot; + hdr + &quot;' in &quot; + Arrays.toString(header));</span>
+<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" id="L1272">    }</span>
+<span class="fc" id="L1410">    }</span>
 
     /**
      * Returns a new {@code CSVFormat} with the missing column names behavior of the format set to {@code true}
@@ -1279,7 +1417,7 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withAllowMissingColumnNames() {
-<span class="fc" id="L1282">        return this.withAllowMissingColumnNames(true);</span>
+<span class="fc" id="L1420">        return this.withAllowMissingColumnNames(true);</span>
     }
 
     /**
@@ -1291,7 +1429,7 @@ 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="L1294">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1432">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
@@ -1308,7 +1446,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="L1311">        return withCommentMarker(Character.valueOf(commentMarker));</span>
+<span class="fc" id="L1449">        return withCommentMarker(Character.valueOf(commentMarker));</span>
     }
 
     /**
@@ -1323,10 +1461,10 @@ 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="L1326" title="All 2 branches covered.">        if (isLineBreak(commentMarker)) {</span>
-<span class="fc" id="L1327">            throw new IllegalArgumentException(&quot;The comment start marker character cannot be a line break&quot;);</span>
+<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" id="L1329">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1467">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
@@ -1341,10 +1479,10 @@ 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="L1344" title="All 2 branches covered.">        if (isLineBreak(delimiter)) {</span>
-<span class="fc" id="L1345">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
+<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" id="L1347">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1485">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
@@ -1359,7 +1497,7 @@ public final class CSVFormat implements
      *             thrown if the specified character is a line break
      */
     public CSVFormat withEscape(final char escape) {
-<span class="fc" id="L1362">        return withEscape(Character.valueOf(escape));</span>
+<span class="fc" id="L1500">        return withEscape(Character.valueOf(escape));</span>
     }
 
     /**
@@ -1372,10 +1510,10 @@ public final class CSVFormat implements
      *             thrown if the specified character is a line break
      */
     public CSVFormat withEscape(final Character escape) {
-<span class="fc bfc" id="L1375" title="All 2 branches covered.">        if (isLineBreak(escape)) {</span>
-<span class="fc" id="L1376">            throw new IllegalArgumentException(&quot;The escape character cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1513" title="All 2 branches covered.">        if (isLineBreak(escape)) {</span>
+<span class="fc" id="L1514">            throw new IllegalArgumentException(&quot;The escape character cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L1378">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escape, ignoreSurroundingSpaces,</span>
+<span class="fc" id="L1516">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escape, ignoreSurroundingSpaces,</span>
                 ignoreEmptyLines, recordSeparator, nullString, headerComments, header, skipHeaderRecord,
                 allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
@@ -1397,7 +1535,7 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public CSVFormat withFirstRecordAsHeader() {
-<span class="fc" id="L1400">        return withHeader().withSkipHeaderRecord();</span>
+<span class="fc" id="L1538">        return withHeader().withSkipHeaderRecord();</span>
     }
 
     /**
@@ -1427,15 +1565,15 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public CSVFormat withHeader(final Class&lt;? extends Enum&lt;?&gt;&gt; headerEnum) {
-<span class="fc" id="L1430">        String[] header = null;</span>
-<span class="pc bpc" id="L1431" title="1 of 2 branches missed.">        if (headerEnum != null) {</span>
-<span class="fc" id="L1432">            final Enum&lt;?&gt;[] enumValues = headerEnum.getEnumConstants();</span>
-<span class="fc" id="L1433">            header = new String[enumValues.length];</span>
-<span class="fc bfc" id="L1434" title="All 2 branches covered.">            for (int i = 0; i &lt; enumValues.length; i++) {</span>
-<span class="fc" id="L1435">                header[i] = enumValues[i].name();</span>
+<span class="fc" id="L1568">        String[] header = null;</span>
+<span class="pc bpc" id="L1569" title="1 of 2 branches missed.">        if (headerEnum != null) {</span>
+<span class="fc" id="L1570">            final Enum&lt;?&gt;[] enumValues = headerEnum.getEnumConstants();</span>
+<span class="fc" id="L1571">            header = new String[enumValues.length];</span>
+<span class="fc bfc" id="L1572" title="All 2 branches covered.">            for (int i = 0; i &lt; enumValues.length; i++) {</span>

[... 231 lines stripped ...]