You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@commons.apache.org by gg...@apache.org on 2020/02/06 20:53:02 UTC

svn commit: r1056196 [17/38] - 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/ css/ images/ jacoco-aggregate/ jac...

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 Thu Feb  6 20:53:01 2020
@@ -633,7 +633,7 @@ public final class CSVFormat implements
      * @param c
      *            the character to check
      *
-     * @return true if <code>c</code> is a line break character
+     * @return true if {@code c} is a line break character
      */
     private static boolean isLineBreak(final char c) {
 <span class="fc bfc" id="L639" title="All 4 branches covered.">        return c == LF || c == CR;</span>
@@ -645,7 +645,7 @@ public final class CSVFormat implements
      * @param c
      *            the character to check, may be null
      *
-     * @return true if &lt;code&gt;c&lt;/code&gt; is a line break character (and not null)
+     * @return true if {@code c} is a line break character (and not null)
      */
     private static boolean isLineBreak(final Character c) {
 <span class="fc bfc" id="L651" title="All 4 branches covered.">        return c != null &amp;&amp; isLineBreak(c.charValue());</span>
@@ -809,57 +809,78 @@ public final class CSVFormat implements
 <span class="fc bfc" id="L809" title="All 2 branches covered.">        if (delimiter != other.delimiter) {</span>
 <span class="fc" id="L810">            return false;</span>
         }
-<span class="fc bfc" id="L812" title="All 2 branches covered.">        if (quoteMode != other.quoteMode) {</span>
+<span class="fc bfc" id="L812" title="All 2 branches covered.">        if (trailingDelimiter != other.trailingDelimiter) {</span>
 <span class="fc" id="L813">            return false;</span>
         }
-<span class="fc bfc" id="L815" title="All 2 branches covered.">        if (quoteCharacter == null) {</span>
-<span class="fc bfc" id="L816" title="All 2 branches covered.">            if (other.quoteCharacter != null) {</span>
-<span class="fc" id="L817">                return false;</span>
+<span class="fc bfc" id="L815" title="All 2 branches covered.">        if (autoFlush != other.autoFlush) {</span>
+<span class="fc" id="L816">            return false;</span>
+        }
+<span class="fc bfc" id="L818" title="All 2 branches covered.">        if (trim != other.trim) {</span>
+<span class="fc" id="L819">            return false;</span>
+        }
+<span class="fc bfc" id="L821" title="All 2 branches covered.">        if (allowMissingColumnNames != other.allowMissingColumnNames) {</span>
+<span class="fc" id="L822">            return false;</span>
+        }
+<span class="fc bfc" id="L824" title="All 2 branches covered.">        if (allowDuplicateHeaderNames != other.allowDuplicateHeaderNames) {</span>
+<span class="fc" id="L825">            return false;</span>
+        }
+<span class="fc bfc" id="L827" title="All 2 branches covered.">        if (ignoreHeaderCase != other.ignoreHeaderCase) {</span>
+<span class="fc" id="L828">            return false;</span>
+        }
+<span class="fc bfc" id="L830" title="All 2 branches covered.">        if (quoteMode != other.quoteMode) {</span>
+<span class="fc" id="L831">            return false;</span>
+        }
+<span class="fc bfc" id="L833" title="All 2 branches covered.">        if (quoteCharacter == null) {</span>
+<span class="fc bfc" id="L834" title="All 2 branches covered.">            if (other.quoteCharacter != null) {</span>
+<span class="fc" id="L835">                return false;</span>
             }
-<span class="fc bfc" id="L819" title="All 2 branches covered.">        } else if (!quoteCharacter.equals(other.quoteCharacter)) {</span>
-<span class="fc" id="L820">            return false;</span>
+<span class="fc bfc" id="L837" title="All 2 branches covered.">        } else if (!quoteCharacter.equals(other.quoteCharacter)) {</span>
+<span class="fc" id="L838">            return false;</span>
         }
-<span class="fc bfc" id="L822" title="All 2 branches covered.">        if (commentMarker == null) {</span>
-<span class="fc bfc" id="L823" title="All 2 branches covered.">            if (other.commentMarker != null) {</span>
-<span class="fc" id="L824">                return false;</span>
+<span class="fc bfc" id="L840" title="All 2 branches covered.">        if (commentMarker == null) {</span>
+<span class="fc bfc" id="L841" title="All 2 branches covered.">            if (other.commentMarker != null) {</span>
+<span class="fc" id="L842">                return false;</span>
             }
-<span class="fc bfc" id="L826" title="All 2 branches covered.">        } else if (!commentMarker.equals(other.commentMarker)) {</span>
-<span class="fc" id="L827">            return false;</span>
+<span class="fc bfc" id="L844" title="All 2 branches covered.">        } else if (!commentMarker.equals(other.commentMarker)) {</span>
+<span class="fc" id="L845">            return false;</span>
         }
-<span class="fc bfc" id="L829" title="All 2 branches covered.">        if (escapeCharacter == null) {</span>
-<span class="pc bpc" id="L830" title="1 of 2 branches missed.">            if (other.escapeCharacter != null) {</span>
-<span class="nc" id="L831">                return false;</span>
+<span class="fc bfc" id="L847" title="All 2 branches covered.">        if (escapeCharacter == null) {</span>
+<span class="fc bfc" id="L848" title="All 2 branches covered.">            if (other.escapeCharacter != null) {</span>
+<span class="fc" id="L849">                return false;</span>
             }
-<span class="fc bfc" id="L833" title="All 2 branches covered.">        } else if (!escapeCharacter.equals(other.escapeCharacter)) {</span>
-<span class="fc" id="L834">            return false;</span>
+<span class="fc bfc" id="L851" title="All 2 branches covered.">        } else if (!escapeCharacter.equals(other.escapeCharacter)) {</span>
+<span class="fc" id="L852">            return false;</span>
         }
-<span class="fc bfc" id="L836" title="All 2 branches covered.">        if (nullString == null) {</span>
-<span class="pc bpc" id="L837" title="1 of 2 branches missed.">            if (other.nullString != null) {</span>
-<span class="nc" id="L838">                return false;</span>
+<span class="fc bfc" id="L854" title="All 2 branches covered.">        if (nullString == null) {</span>
+<span class="fc bfc" id="L855" title="All 2 branches covered.">            if (other.nullString != null) {</span>
+<span class="fc" id="L856">                return false;</span>
             }
-<span class="fc bfc" id="L840" title="All 2 branches covered.">        } else if (!nullString.equals(other.nullString)) {</span>
-<span class="fc" id="L841">            return false;</span>
+<span class="fc bfc" id="L858" title="All 2 branches covered.">        } else if (!nullString.equals(other.nullString)) {</span>
+<span class="fc" id="L859">            return false;</span>
         }
-<span class="fc bfc" id="L843" title="All 2 branches covered.">        if (!Arrays.equals(header, other.header)) {</span>
-<span class="fc" id="L844">            return false;</span>
+<span class="fc bfc" id="L861" title="All 2 branches covered.">        if (!Arrays.equals(header, other.header)) {</span>
+<span class="fc" id="L862">            return false;</span>
         }
-<span class="fc bfc" id="L846" title="All 2 branches covered.">        if (ignoreSurroundingSpaces != other.ignoreSurroundingSpaces) {</span>
-<span class="fc" id="L847">            return false;</span>
+<span class="fc bfc" id="L864" title="All 2 branches covered.">        if (ignoreSurroundingSpaces != other.ignoreSurroundingSpaces) {</span>
+<span class="fc" id="L865">            return false;</span>
         }
-<span class="fc bfc" id="L849" title="All 2 branches covered.">        if (ignoreEmptyLines != other.ignoreEmptyLines) {</span>
-<span class="fc" id="L850">            return false;</span>
+<span class="fc bfc" id="L867" title="All 2 branches covered.">        if (ignoreEmptyLines != other.ignoreEmptyLines) {</span>
+<span class="fc" id="L868">            return false;</span>
         }
-<span class="fc bfc" id="L852" title="All 2 branches covered.">        if (skipHeaderRecord != other.skipHeaderRecord) {</span>
-<span class="fc" id="L853">            return false;</span>
+<span class="fc bfc" id="L870" title="All 2 branches covered.">        if (skipHeaderRecord != other.skipHeaderRecord) {</span>
+<span class="fc" id="L871">            return false;</span>
         }
-<span class="fc bfc" id="L855" title="All 2 branches covered.">        if (recordSeparator == null) {</span>
-<span class="pc bpc" id="L856" title="1 of 2 branches missed.">            if (other.recordSeparator != null) {</span>
-<span class="nc" id="L857">                return false;</span>
+<span class="fc bfc" id="L873" title="All 2 branches covered.">        if (recordSeparator == null) {</span>
+<span class="fc bfc" id="L874" title="All 2 branches covered.">            if (other.recordSeparator != null) {</span>
+<span class="fc" id="L875">                return false;</span>
             }
-<span class="fc bfc" id="L859" title="All 2 branches covered.">        } else if (!recordSeparator.equals(other.recordSeparator)) {</span>
-<span class="fc" id="L860">            return false;</span>
+<span class="fc bfc" id="L877" title="All 2 branches covered.">        } else if (!recordSeparator.equals(other.recordSeparator)) {</span>
+<span class="fc" id="L878">            return false;</span>
         }
-<span class="fc" id="L862">        return true;</span>
+<span class="fc bfc" id="L880" title="All 2 branches covered.">        if (!Arrays.equals(headerComments, other.headerComments)) {</span>
+<span class="fc" id="L881">            return false;</span>
+        }
+<span class="fc" id="L883">        return true;</span>
     }
 
     /**
@@ -870,13 +891,13 @@ public final class CSVFormat implements
      * @return the formatted values
      */
     public String format(final Object... values) {
-<span class="fc" id="L873">        final StringWriter out = new StringWriter();</span>
-<span class="fc" id="L874">        try (final CSVPrinter csvPrinter = new CSVPrinter(out, this)) {</span>
-<span class="fc" id="L875">            csvPrinter.printRecord(values);</span>
-<span class="fc" id="L876">            return out.toString().trim();</span>
-<span class="nc" id="L877">        } catch (final IOException e) {</span>
+<span class="fc" id="L894">        final StringWriter out = new StringWriter();</span>
+<span class="fc" id="L895">        try (CSVPrinter csvPrinter = new CSVPrinter(out, this)) {</span>
+<span class="fc" id="L896">            csvPrinter.printRecord(values);</span>
+<span class="fc" id="L897">            return out.toString().trim();</span>
+<span class="nc" id="L898">        } catch (final IOException e) {</span>
             // should not happen because a StringWriter does not do IO.
-<span class="nc" id="L879">            throw new IllegalStateException(e);</span>
+<span class="nc" id="L900">            throw new IllegalStateException(e);</span>
         }
     }
 
@@ -887,7 +908,7 @@ public final class CSVFormat implements
      * @since 1.7
      */
     public boolean getAllowDuplicateHeaderNames() {
-<span class="fc" id="L890">        return allowDuplicateHeaderNames;</span>
+<span class="fc" id="L911">        return allowDuplicateHeaderNames;</span>
     }
 
     /**
@@ -897,7 +918,7 @@ public final class CSVFormat implements
      *         {@link IllegalArgumentException}.
      */
     public boolean getAllowMissingColumnNames() {
-<span class="fc" id="L900">        return allowMissingColumnNames;</span>
+<span class="fc" id="L921">        return allowMissingColumnNames;</span>
     }
 
     /**
@@ -907,7 +928,7 @@ public final class CSVFormat implements
      * @since 1.6
      */
     public boolean getAutoFlush() {
-<span class="fc" id="L910">        return autoFlush;</span>
+<span class="fc" id="L931">        return autoFlush;</span>
     }
 
     /**
@@ -916,7 +937,7 @@ public final class CSVFormat implements
      * @return the comment start marker, may be {@code null}
      */
     public Character getCommentMarker() {
-<span class="fc" id="L919">        return commentMarker;</span>
+<span class="fc" id="L940">        return commentMarker;</span>
     }
 
     /**
@@ -925,7 +946,7 @@ public final class CSVFormat implements
      * @return the delimiter character
      */
     public char getDelimiter() {
-<span class="fc" id="L928">        return delimiter;</span>
+<span class="fc" id="L949">        return delimiter;</span>
     }
 
     /**
@@ -934,7 +955,7 @@ public final class CSVFormat implements
      * @return the escape character, may be {@code null}
      */
     public Character getEscapeCharacter() {
-<span class="fc" id="L937">        return escapeCharacter;</span>
+<span class="fc" id="L958">        return escapeCharacter;</span>
     }
 
     /**
@@ -943,7 +964,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="L946" title="All 2 branches covered.">        return header != null ? header.clone() : null;</span>
+<span class="fc bfc" id="L967" title="All 2 branches covered.">        return header != null ? header.clone() : null;</span>
     }
 
     /**
@@ -952,7 +973,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="L955" title="All 2 branches covered.">        return headerComments != null ? headerComments.clone() : null;</span>
+<span class="fc bfc" id="L976" title="All 2 branches covered.">        return headerComments != null ? headerComments.clone() : null;</span>
     }
 
     /**
@@ -962,7 +983,7 @@ public final class CSVFormat implements
      *         records.
      */
     public boolean getIgnoreEmptyLines() {
-<span class="fc" id="L965">        return ignoreEmptyLines;</span>
+<span class="fc" id="L986">        return ignoreEmptyLines;</span>
     }
 
     /**
@@ -972,7 +993,7 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public boolean getIgnoreHeaderCase() {
-<span class="fc" id="L975">        return ignoreHeaderCase;</span>
+<span class="fc" id="L996">        return ignoreHeaderCase;</span>
     }
 
     /**
@@ -981,7 +1002,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="L984">        return ignoreSurroundingSpaces;</span>
+<span class="fc" id="L1005">        return ignoreSurroundingSpaces;</span>
     }
 
     /**
@@ -995,7 +1016,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="L998">        return nullString;</span>
+<span class="fc" id="L1019">        return nullString;</span>
     }
 
     /**
@@ -1004,7 +1025,7 @@ public final class CSVFormat implements
      * @return the quoteChar character, may be {@code null}
      */
     public Character getQuoteCharacter() {
-<span class="fc" id="L1007">        return quoteCharacter;</span>
+<span class="fc" id="L1028">        return quoteCharacter;</span>
     }
 
     /**
@@ -1013,7 +1034,7 @@ public final class CSVFormat implements
      * @return the quote policy
      */
     public QuoteMode getQuoteMode() {
-<span class="fc" id="L1016">        return quoteMode;</span>
+<span class="fc" id="L1037">        return quoteMode;</span>
     }
 
     /**
@@ -1022,7 +1043,7 @@ public final class CSVFormat implements
      * @return the record separator
      */
     public String getRecordSeparator() {
-<span class="fc" id="L1025">        return recordSeparator;</span>
+<span class="fc" id="L1046">        return recordSeparator;</span>
     }
 
     /**
@@ -1031,7 +1052,7 @@ public final class CSVFormat implements
      * @return whether to skip the header record.
      */
     public boolean getSkipHeaderRecord() {
-<span class="fc" id="L1034">        return skipHeaderRecord;</span>
+<span class="fc" id="L1055">        return skipHeaderRecord;</span>
     }
 
     /**
@@ -1041,36 +1062,44 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public boolean getTrailingDelimiter() {
-<span class="fc" id="L1044">        return trailingDelimiter;</span>
+<span class="fc" id="L1065">        return trailingDelimiter;</span>
     }
 
     /**
      * Returns whether to trim leading and trailing blanks.
+     * This is used by {@link #print(Object, Appendable, boolean)}
+     * Also by {@link CSVParser#addRecordValue(boolean)}
      *
      * @return whether to trim leading and trailing blanks.
      */
     public boolean getTrim() {
-<span class="fc" id="L1053">        return trim;</span>
+<span class="fc" id="L1076">        return trim;</span>
     }
 
     @Override
     public int hashCode() {
-<span class="fc" id="L1058">        final int prime = 31;</span>
-<span class="fc" id="L1059">        int result = 1;</span>
+<span class="fc" id="L1081">        final int prime = 31;</span>
+<span class="fc" id="L1082">        int result = 1;</span>
 
-<span class="fc" id="L1061">        result = prime * result + delimiter;</span>
-<span class="pc bpc" id="L1062" title="1 of 2 branches missed.">        result = prime * result + ((quoteMode == null) ? 0 : quoteMode.hashCode());</span>
-<span class="pc bpc" id="L1063" title="1 of 2 branches missed.">        result = prime * result + ((quoteCharacter == null) ? 0 : quoteCharacter.hashCode());</span>
-<span class="pc bpc" id="L1064" title="1 of 2 branches missed.">        result = prime * result + ((commentMarker == null) ? 0 : commentMarker.hashCode());</span>
-<span class="pc bpc" id="L1065" title="1 of 2 branches missed.">        result = prime * result + ((escapeCharacter == null) ? 0 : escapeCharacter.hashCode());</span>
-<span class="pc bpc" id="L1066" title="1 of 2 branches missed.">        result = prime * result + ((nullString == null) ? 0 : nullString.hashCode());</span>
-<span class="pc bpc" id="L1067" title="1 of 2 branches missed.">        result = prime * result + (ignoreSurroundingSpaces ? 1231 : 1237);</span>
-<span class="fc bfc" id="L1068" title="All 2 branches covered.">        result = prime * result + (ignoreHeaderCase ? 1231 : 1237);</span>
-<span class="pc bpc" id="L1069" title="1 of 2 branches missed.">        result = prime * result + (ignoreEmptyLines ? 1231 : 1237);</span>
-<span class="pc bpc" id="L1070" title="1 of 2 branches missed.">        result = prime * result + (skipHeaderRecord ? 1231 : 1237);</span>
-<span class="pc bpc" id="L1071" title="1 of 2 branches missed.">        result = prime * result + ((recordSeparator == null) ? 0 : recordSeparator.hashCode());</span>
-<span class="fc" id="L1072">        result = prime * result + Arrays.hashCode(header);</span>
-<span class="fc" id="L1073">        return result;</span>
+<span class="fc" id="L1084">        result = prime * result + delimiter;</span>
+<span class="fc bfc" id="L1085" title="All 2 branches covered.">        result = prime * result + ((quoteMode == null) ? 0 : quoteMode.hashCode());</span>
+<span class="fc bfc" id="L1086" title="All 2 branches covered.">        result = prime * result + ((quoteCharacter == null) ? 0 : quoteCharacter.hashCode());</span>
+<span class="fc bfc" id="L1087" title="All 2 branches covered.">        result = prime * result + ((commentMarker == null) ? 0 : commentMarker.hashCode());</span>
+<span class="fc bfc" id="L1088" title="All 2 branches covered.">        result = prime * result + ((escapeCharacter == null) ? 0 : escapeCharacter.hashCode());</span>
+<span class="fc bfc" id="L1089" title="All 2 branches covered.">        result = prime * result + ((nullString == null) ? 0 : nullString.hashCode());</span>
+<span class="fc bfc" id="L1090" title="All 2 branches covered.">        result = prime * result + (ignoreSurroundingSpaces ? 1231 : 1237);</span>
+<span class="fc bfc" id="L1091" title="All 2 branches covered.">        result = prime * result + (ignoreHeaderCase ? 1231 : 1237);</span>
+<span class="fc bfc" id="L1092" title="All 2 branches covered.">        result = prime * result + (ignoreEmptyLines ? 1231 : 1237);</span>
+<span class="fc bfc" id="L1093" title="All 2 branches covered.">        result = prime * result + (skipHeaderRecord ? 1231 : 1237);</span>
+<span class="fc bfc" id="L1094" title="All 2 branches covered.">        result = prime * result + (allowDuplicateHeaderNames ? 1231 : 1237);</span>
+<span class="fc bfc" id="L1095" title="All 2 branches covered.">        result = prime * result + (trim ? 1231 : 1237);</span>
+<span class="fc bfc" id="L1096" title="All 2 branches covered.">        result = prime * result + (autoFlush ? 1231 : 1237);</span>
+<span class="fc bfc" id="L1097" title="All 2 branches covered.">        result = prime * result + (trailingDelimiter ? 1231 : 1237);</span>
+<span class="fc bfc" id="L1098" title="All 2 branches covered.">        result = prime * result + (allowMissingColumnNames ? 1231 : 1237);</span>
+<span class="fc bfc" id="L1099" title="All 2 branches covered.">        result = prime * result + ((recordSeparator == null) ? 0 : recordSeparator.hashCode());</span>
+<span class="fc" id="L1100">        result = prime * result + Arrays.hashCode(header);</span>
+<span class="fc" id="L1101">        result = prime * result + Arrays.hashCode(headerComments);</span>
+<span class="fc" id="L1102">        return result;</span>
     }
 
     /**
@@ -1081,7 +1110,7 @@ public final class CSVFormat implements
      * @return {@code true} is comments are supported, {@code false} otherwise
      */
     public boolean isCommentMarkerSet() {
-<span class="fc bfc" id="L1084" title="All 2 branches covered.">        return commentMarker != null;</span>
+<span class="fc bfc" id="L1113" title="All 2 branches covered.">        return commentMarker != null;</span>
     }
 
     /**
@@ -1090,7 +1119,7 @@ public final class CSVFormat implements
      * @return {@code true} if escapes are processed
      */
     public boolean isEscapeCharacterSet() {
-<span class="fc bfc" id="L1093" title="All 2 branches covered.">        return escapeCharacter != null;</span>
+<span class="fc bfc" id="L1122" title="All 2 branches covered.">        return escapeCharacter != null;</span>
     }
 
     /**
@@ -1099,7 +1128,7 @@ public final class CSVFormat implements
      * @return {@code true} if a nullString is defined
      */
     public boolean isNullStringSet() {
-<span class="fc bfc" id="L1102" title="All 2 branches covered.">        return nullString != null;</span>
+<span class="fc bfc" id="L1131" title="All 2 branches covered.">        return nullString != null;</span>
     }
 
     /**
@@ -1108,7 +1137,7 @@ public final class CSVFormat implements
      * @return {@code true} if a quoteChar is defined
      */
     public boolean isQuoteCharacterSet() {
-<span class="fc bfc" id="L1111" title="All 2 branches covered.">        return quoteCharacter != null;</span>
+<span class="fc bfc" id="L1140" title="All 2 branches covered.">        return quoteCharacter != null;</span>
     }
 
     /**
@@ -1125,7 +1154,7 @@ public final class CSVFormat implements
      *             If an I/O error occurs
      */
     public CSVParser parse(final Reader in) throws IOException {
-<span class="fc" id="L1128">        return new CSVParser(in, this);</span>
+<span class="fc" id="L1157">        return new CSVParser(in, this);</span>
     }
 
     /**
@@ -1142,7 +1171,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="L1145">        return new CSVPrinter(out, this);</span>
+<span class="fc" id="L1174">        return new CSVPrinter(out, this);</span>
     }
 
     /**
@@ -1164,13 +1193,13 @@ public final class CSVFormat implements
     @SuppressWarnings(&quot;resource&quot;)
     public CSVPrinter print(final File out, final Charset charset) throws IOException {
         // The writer will be closed when close() is called.
-<span class="fc" id="L1167">        return new CSVPrinter(new OutputStreamWriter(new FileOutputStream(out), charset), this);</span>
+<span class="fc" id="L1196">        return new CSVPrinter(new OutputStreamWriter(new FileOutputStream(out), charset), this);</span>
     }
 
     /**
      * Prints the {@code value} as the next value on the line to {@code out}. The value will be escaped or encapsulated
      * as needed. Useful when one wants to avoid creating CSVPrinters.
-     *
+     * Trims the value if {@link #getTrim()} is true
      * @param value
      *            value to output.
      * @param out
@@ -1185,49 +1214,49 @@ 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="L1188" title="All 2 branches covered.">        if (value == null) {</span>
+<span class="fc bfc" id="L1217" title="All 2 branches covered.">        if (value == null) {</span>
             // https://issues.apache.org/jira/browse/CSV-203
-<span class="fc bfc" id="L1190" title="All 2 branches covered.">            if (null == nullString) {</span>
-<span class="fc" id="L1191">                charSequence = EMPTY;</span>
+<span class="fc bfc" id="L1219" title="All 2 branches covered.">            if (null == nullString) {</span>
+<span class="fc" id="L1220">                charSequence = EMPTY;</span>
             } else {
-<span class="fc bfc" id="L1193" title="All 2 branches covered.">                if (QuoteMode.ALL == quoteMode) {</span>
-<span class="fc" id="L1194">                    charSequence = quotedNullString;</span>
+<span class="fc bfc" id="L1222" title="All 2 branches covered.">                if (QuoteMode.ALL == quoteMode) {</span>
+<span class="fc" id="L1223">                    charSequence = quotedNullString;</span>
                 } else {
-<span class="fc" id="L1196">                    charSequence = nullString;</span>
+<span class="fc" id="L1225">                    charSequence = nullString;</span>
                 }
             }
         } else {
-<span class="fc bfc" id="L1200" title="All 2 branches covered.">            if (value instanceof CharSequence) {</span>
-<span class="fc" id="L1201">                charSequence = (CharSequence) value;</span>
-<span class="fc bfc" id="L1202" title="All 2 branches covered.">            } else if (value instanceof Reader) {</span>
-<span class="fc" id="L1203">                print((Reader) value, out, newRecord);</span>
-<span class="fc" id="L1204">                return;</span>
+<span class="fc bfc" id="L1229" title="All 2 branches covered.">            if (value instanceof CharSequence) {</span>
+<span class="fc" id="L1230">                charSequence = (CharSequence) value;</span>
+<span class="fc bfc" id="L1231" title="All 2 branches covered.">            } else if (value instanceof Reader) {</span>
+<span class="fc" id="L1232">                print((Reader) value, out, newRecord);</span>
+<span class="fc" id="L1233">                return;</span>
             } else {
-<span class="fc" id="L1206">                charSequence = value.toString();</span>
+<span class="fc" id="L1235">                charSequence = value.toString();</span>
             }
         }
-<span class="fc bfc" id="L1209" title="All 2 branches covered.">        charSequence = getTrim() ? trim(charSequence) : charSequence;</span>
-<span class="fc" id="L1210">        print(value, charSequence, out, newRecord);</span>
-<span class="fc" id="L1211">    }</span>
+<span class="fc bfc" id="L1238" title="All 2 branches covered.">        charSequence = getTrim() ? trim(charSequence) : charSequence;</span>
+<span class="fc" id="L1239">        print(value, charSequence, out, newRecord);</span>
+<span class="fc" id="L1240">    }</span>
 
     private void print(final Object object, final CharSequence value, final Appendable out, final boolean newRecord)
             throws IOException {
-<span class="fc" id="L1215">        final int offset = 0;</span>
-<span class="fc" id="L1216">        final int len = value.length();</span>
-<span class="fc bfc" id="L1217" title="All 2 branches covered.">        if (!newRecord) {</span>
-<span class="fc" id="L1218">            out.append(getDelimiter());</span>
-        }
-<span class="fc bfc" id="L1220" title="All 2 branches covered.">        if (object == null) {</span>
-<span class="fc" id="L1221">            out.append(value);</span>
-<span class="fc bfc" id="L1222" title="All 2 branches covered.">        } else if (isQuoteCharacterSet()) {</span>
+<span class="fc" id="L1244">        final int offset = 0;</span>
+<span class="fc" id="L1245">        final int len = value.length();</span>
+<span class="fc bfc" id="L1246" title="All 2 branches covered.">        if (!newRecord) {</span>
+<span class="fc" id="L1247">            out.append(getDelimiter());</span>
+        }
+<span class="fc bfc" id="L1249" title="All 2 branches covered.">        if (object == null) {</span>
+<span class="fc" id="L1250">            out.append(value);</span>
+<span class="fc bfc" id="L1251" title="All 2 branches covered.">        } else if (isQuoteCharacterSet()) {</span>
             // the original object is needed so can check for Number
-<span class="fc" id="L1224">            printWithQuotes(object, value, out, newRecord);</span>
-<span class="fc bfc" id="L1225" title="All 2 branches covered.">        } else if (isEscapeCharacterSet()) {</span>
-<span class="fc" id="L1226">            printWithEscapes(value, out);</span>
+<span class="fc" id="L1253">            printWithQuotes(object, value, out, newRecord);</span>
+<span class="fc bfc" id="L1254" title="All 2 branches covered.">        } else if (isEscapeCharacterSet()) {</span>
+<span class="fc" id="L1255">            printWithEscapes(value, out);</span>
         } else {
-<span class="fc" id="L1228">            out.append(value, offset, len);</span>
+<span class="fc" id="L1257">            out.append(value, offset, len);</span>
         }
-<span class="fc" id="L1230">    }</span>
+<span class="fc" id="L1259">    }</span>
 
     /**
      * Prints to the specified output.
@@ -1246,25 +1275,25 @@ public final class CSVFormat implements
      * @since 1.5
      */
     public CSVPrinter print(final Path out, final Charset charset) throws IOException {
-<span class="fc" id="L1249">        return print(Files.newBufferedWriter(out, charset));</span>
+<span class="fc" id="L1278">        return print(Files.newBufferedWriter(out, charset));</span>
     }
 
     private void print(final Reader reader, final Appendable out, final boolean newRecord) throws IOException {
         // Reader is never null
-<span class="pc bpc" id="L1254" title="1 of 2 branches missed.">        if (!newRecord) {</span>
-<span class="fc" id="L1255">            out.append(getDelimiter());</span>
+<span class="fc bfc" id="L1283" title="All 2 branches covered.">        if (!newRecord) {</span>
+<span class="fc" id="L1284">            out.append(getDelimiter());</span>
         }
-<span class="pc bpc" id="L1257" title="1 of 2 branches missed.">        if (isQuoteCharacterSet()) {</span>
-<span class="fc" id="L1258">            printWithQuotes(reader, out);</span>
-<span class="nc bnc" id="L1259" title="All 2 branches missed.">        } else if (isEscapeCharacterSet()) {</span>
-<span class="nc" id="L1260">            printWithEscapes(reader, out);</span>
-<span class="nc bnc" id="L1261" title="All 2 branches missed.">        } else if (out instanceof Writer) {</span>
-<span class="nc" id="L1262">            IOUtils.copyLarge(reader, (Writer) out);</span>
+<span class="fc bfc" id="L1286" title="All 2 branches covered.">        if (isQuoteCharacterSet()) {</span>
+<span class="fc" id="L1287">            printWithQuotes(reader, out);</span>
+<span class="pc bpc" id="L1288" title="1 of 2 branches missed.">        } else if (isEscapeCharacterSet()) {</span>
+<span class="nc" id="L1289">            printWithEscapes(reader, out);</span>
+<span class="fc bfc" id="L1290" title="All 2 branches covered.">        } else if (out instanceof Writer) {</span>
+<span class="fc" id="L1291">            IOUtils.copyLarge(reader, (Writer) out);</span>
         } else {
-<span class="nc" id="L1264">            IOUtils.copy(reader, out);</span>
+<span class="fc" id="L1293">            IOUtils.copy(reader, out);</span>
         }
 
-<span class="fc" id="L1267">    }</span>
+<span class="fc" id="L1296">    }</span>
 
     /**
      * Prints to the {@link System#out}.
@@ -1279,7 +1308,7 @@ public final class CSVFormat implements
      * @since 1.5
      */
     public CSVPrinter printer() throws IOException {
-<span class="fc" id="L1282">        return new CSVPrinter(System.out, this);</span>
+<span class="fc" id="L1311">        return new CSVPrinter(System.out, this);</span>
     }
 
     /**
@@ -1292,13 +1321,13 @@ public final class CSVFormat implements
      * @since 1.4
      */
     public void println(final Appendable out) throws IOException {
-<span class="fc bfc" id="L1295" title="All 2 branches covered.">        if (getTrailingDelimiter()) {</span>
-<span class="fc" id="L1296">            out.append(getDelimiter());</span>
+<span class="fc bfc" id="L1324" title="All 2 branches covered.">        if (getTrailingDelimiter()) {</span>
+<span class="fc" id="L1325">            out.append(getDelimiter());</span>
         }
-<span class="fc bfc" id="L1298" title="All 2 branches covered.">        if (recordSeparator != null) {</span>
-<span class="fc" id="L1299">            out.append(recordSeparator);</span>
+<span class="fc bfc" id="L1327" title="All 2 branches covered.">        if (recordSeparator != null) {</span>
+<span class="fc" id="L1328">            out.append(recordSeparator);</span>
         }
-<span class="fc" id="L1301">    }</span>
+<span class="fc" id="L1330">    }</span>
 
     /**
      * Prints the given {@code values} to {@code out} as a single record of delimiter separated values followed by the
@@ -1318,87 +1347,87 @@ public final class CSVFormat implements
      * @since 1.4
      */
     public void printRecord(final Appendable out, final Object... values) throws IOException {
-<span class="fc bfc" id="L1321" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
-<span class="fc bfc" id="L1322" title="All 2 branches covered.">            print(values[i], out, i == 0);</span>
+<span class="fc bfc" id="L1350" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
+<span class="fc bfc" id="L1351" title="All 2 branches covered.">            print(values[i], out, i == 0);</span>
         }
-<span class="fc" id="L1324">        println(out);</span>
-<span class="fc" id="L1325">    }</span>
+<span class="fc" id="L1353">        println(out);</span>
+<span class="fc" id="L1354">    }</span>
 
     /*
      * Note: must only be called if escaping is enabled, otherwise will generate NPE
      */
     private void printWithEscapes(final CharSequence value, final Appendable out) throws IOException {
-<span class="fc" id="L1331">        int start = 0;</span>
-<span class="fc" id="L1332">        int pos = 0;</span>
-<span class="fc" id="L1333">        final int len = value.length();</span>
-<span class="fc" id="L1334">        final int end = len;</span>
-
-<span class="fc" id="L1336">        final char delim = getDelimiter();</span>
-<span class="fc" id="L1337">        final char escape = getEscapeCharacter().charValue();</span>
-
-<span class="fc bfc" id="L1339" title="All 2 branches covered.">        while (pos &lt; end) {</span>
-<span class="fc" id="L1340">            char c = value.charAt(pos);</span>
-<span class="fc bfc" id="L1341" title="All 8 branches covered.">            if (c == CR || c == LF || c == delim || c == escape) {</span>
+<span class="fc" id="L1360">        int start = 0;</span>
+<span class="fc" id="L1361">        int pos = 0;</span>
+<span class="fc" id="L1362">        final int len = value.length();</span>
+<span class="fc" id="L1363">        final int end = len;</span>
+
+<span class="fc" id="L1365">        final char delim = getDelimiter();</span>
+<span class="fc" id="L1366">        final char escape = getEscapeCharacter().charValue();</span>
+
+<span class="fc bfc" id="L1368" title="All 2 branches covered.">        while (pos &lt; end) {</span>
+<span class="fc" id="L1369">            char c = value.charAt(pos);</span>
+<span class="fc bfc" id="L1370" 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="L1343" title="All 2 branches covered.">                if (pos &gt; start) {</span>
-<span class="fc" id="L1344">                    out.append(value, start, pos);</span>
+<span class="fc bfc" id="L1372" title="All 2 branches covered.">                if (pos &gt; start) {</span>
+<span class="fc" id="L1373">                    out.append(value, start, pos);</span>
                 }
-<span class="fc bfc" id="L1346" title="All 2 branches covered.">                if (c == LF) {</span>
-<span class="fc" id="L1347">                    c = 'n';</span>
-<span class="fc bfc" id="L1348" title="All 2 branches covered.">                } else if (c == CR) {</span>
-<span class="fc" id="L1349">                    c = 'r';</span>
+<span class="fc bfc" id="L1375" title="All 2 branches covered.">                if (c == LF) {</span>
+<span class="fc" id="L1376">                    c = 'n';</span>
+<span class="fc bfc" id="L1377" title="All 2 branches covered.">                } else if (c == CR) {</span>
+<span class="fc" id="L1378">                    c = 'r';</span>
                 }
 
-<span class="fc" id="L1352">                out.append(escape);</span>
-<span class="fc" id="L1353">                out.append(c);</span>
+<span class="fc" id="L1381">                out.append(escape);</span>
+<span class="fc" id="L1382">                out.append(c);</span>
 
-<span class="fc" id="L1355">                start = pos + 1; // start on the current char after this one</span>
+<span class="fc" id="L1384">                start = pos + 1; // start on the current char after this one</span>
             }
-<span class="fc" id="L1357">            pos++;</span>
-<span class="fc" id="L1358">        }</span>
+<span class="fc" id="L1386">            pos++;</span>
+<span class="fc" id="L1387">        }</span>
 
         // write last segment
-<span class="fc bfc" id="L1361" title="All 2 branches covered.">        if (pos &gt; start) {</span>
-<span class="fc" id="L1362">            out.append(value, start, pos);</span>
+<span class="fc bfc" id="L1390" title="All 2 branches covered.">        if (pos &gt; start) {</span>
+<span class="fc" id="L1391">            out.append(value, start, pos);</span>
         }
-<span class="fc" id="L1364">    }</span>
+<span class="fc" id="L1393">    }</span>
 
     private void printWithEscapes(final Reader reader, final Appendable out) throws IOException {
-<span class="nc" id="L1367">        int start = 0;</span>
-<span class="nc" id="L1368">        int pos = 0;</span>
+<span class="nc" id="L1396">        int start = 0;</span>
+<span class="nc" id="L1397">        int pos = 0;</span>
 
-<span class="nc" id="L1370">        final char delim = getDelimiter();</span>
-<span class="nc" id="L1371">        final char escape = getEscapeCharacter().charValue();</span>
-<span class="nc" id="L1372">        final StringBuilder builder = new StringBuilder(IOUtils.DEFAULT_BUFFER_SIZE);</span>
+<span class="nc" id="L1399">        final char delim = getDelimiter();</span>
+<span class="nc" id="L1400">        final char escape = getEscapeCharacter().charValue();</span>
+<span class="nc" id="L1401">        final StringBuilder builder = new StringBuilder(IOUtils.DEFAULT_BUFFER_SIZE);</span>
 
         int c;
-<span class="nc bnc" id="L1375" title="All 2 branches missed.">        while (-1 != (c = reader.read())) {</span>
-<span class="nc" id="L1376">            builder.append((char) c);</span>
-<span class="nc bnc" id="L1377" title="All 8 branches missed.">            if (c == CR || c == LF || c == delim || c == escape) {</span>
+<span class="nc bnc" id="L1404" title="All 2 branches missed.">        while (-1 != (c = reader.read())) {</span>
+<span class="nc" id="L1405">            builder.append((char) c);</span>
+<span class="nc bnc" id="L1406" title="All 8 branches missed.">            if (c == CR || c == LF || c == delim || c == escape) {</span>
                 // write out segment up until this char
-<span class="nc bnc" id="L1379" title="All 2 branches missed.">                if (pos &gt; start) {</span>
-<span class="nc" id="L1380">                    out.append(builder.substring(start, pos));</span>
-<span class="nc" id="L1381">                    builder.setLength(0);</span>
+<span class="nc bnc" id="L1408" title="All 2 branches missed.">                if (pos &gt; start) {</span>
+<span class="nc" id="L1409">                    out.append(builder.substring(start, pos));</span>
+<span class="nc" id="L1410">                    builder.setLength(0);</span>
                 }
-<span class="nc bnc" id="L1383" title="All 2 branches missed.">                if (c == LF) {</span>
-<span class="nc" id="L1384">                    c = 'n';</span>
-<span class="nc bnc" id="L1385" title="All 2 branches missed.">                } else if (c == CR) {</span>
-<span class="nc" id="L1386">                    c = 'r';</span>
+<span class="nc bnc" id="L1412" title="All 2 branches missed.">                if (c == LF) {</span>
+<span class="nc" id="L1413">                    c = 'n';</span>
+<span class="nc bnc" id="L1414" title="All 2 branches missed.">                } else if (c == CR) {</span>
+<span class="nc" id="L1415">                    c = 'r';</span>
                 }
 
-<span class="nc" id="L1389">                out.append(escape);</span>
-<span class="nc" id="L1390">                out.append((char) c);</span>
+<span class="nc" id="L1418">                out.append(escape);</span>
+<span class="nc" id="L1419">                out.append((char) c);</span>
 
-<span class="nc" id="L1392">                start = pos + 1; // start on the current char after this one</span>
+<span class="nc" id="L1421">                start = pos + 1; // start on the current char after this one</span>
             }
-<span class="nc" id="L1394">            pos++;</span>
+<span class="nc" id="L1423">            pos++;</span>
         }
 
         // write last segment
-<span class="nc bnc" id="L1398" title="All 2 branches missed.">        if (pos &gt; start) {</span>
-<span class="nc" id="L1399">            out.append(builder.substring(start, pos));</span>
+<span class="nc bnc" id="L1427" title="All 2 branches missed.">        if (pos &gt; start) {</span>
+<span class="nc" id="L1428">            out.append(builder.substring(start, pos));</span>
         }
-<span class="nc" id="L1401">    }</span>
+<span class="nc" id="L1430">    }</span>
 
     /*
      * Note: must only be called if quoting is enabled, otherwise will generate NPE
@@ -1406,109 +1435,110 @@ public final class CSVFormat implements
     // the original object is needed so can check for Number
     private void printWithQuotes(final Object object, final CharSequence value, final Appendable out,
             final boolean newRecord) throws IOException {
-<span class="fc" id="L1409">        boolean quote = false;</span>
-<span class="fc" id="L1410">        int start = 0;</span>
-<span class="fc" id="L1411">        int pos = 0;</span>
-<span class="fc" id="L1412">        final int len = value.length();</span>
-<span class="fc" id="L1413">        final int end = len;</span>
-
-<span class="fc" id="L1415">        final char delimChar = getDelimiter();</span>
-<span class="fc" id="L1416">        final char quoteChar = getQuoteCharacter().charValue();</span>
-
-<span class="fc" id="L1418">        QuoteMode quoteModePolicy = getQuoteMode();</span>
-<span class="fc bfc" id="L1419" title="All 2 branches covered.">        if (quoteModePolicy == null) {</span>
-<span class="fc" id="L1420">            quoteModePolicy = QuoteMode.MINIMAL;</span>
+<span class="fc" id="L1438">        boolean quote = false;</span>
+<span class="fc" id="L1439">        int start = 0;</span>
+<span class="fc" id="L1440">        int pos = 0;</span>
+<span class="fc" id="L1441">        final int len = value.length();</span>
+<span class="fc" id="L1442">        final int end = len;</span>
+
+<span class="fc" id="L1444">        final char delimChar = getDelimiter();</span>
+<span class="fc" id="L1445">        final char quoteChar = getQuoteCharacter().charValue();</span>
+        // If escape char not specified, default to the quote char
+        // This avoids having to keep checking whether there is an escape character
+        // at the cost of checking against quote twice
+<span class="fc bfc" id="L1449" title="All 2 branches covered.">        final char escapeChar = isEscapeCharacterSet() ? getEscapeCharacter().charValue() : quoteChar;</span>
+
+<span class="fc" id="L1451">        QuoteMode quoteModePolicy = getQuoteMode();</span>
+<span class="fc bfc" id="L1452" title="All 2 branches covered.">        if (quoteModePolicy == null) {</span>
+<span class="fc" id="L1453">            quoteModePolicy = QuoteMode.MINIMAL;</span>
         }
-<span class="pc bpc" id="L1422" title="1 of 5 branches missed.">        switch (quoteModePolicy) {</span>
+<span class="pc bpc" id="L1455" title="1 of 5 branches missed.">        switch (quoteModePolicy) {</span>
         case ALL:
         case ALL_NON_NULL:
-<span class="fc" id="L1425">            quote = true;</span>
-<span class="fc" id="L1426">            break;</span>
+<span class="fc" id="L1458">            quote = true;</span>
+<span class="fc" id="L1459">            break;</span>
         case NON_NUMERIC:
-<span class="fc bfc" id="L1428" title="All 2 branches covered.">            quote = !(object instanceof Number);</span>
-<span class="fc" id="L1429">            break;</span>
+<span class="fc bfc" id="L1461" title="All 2 branches covered.">            quote = !(object instanceof Number);</span>
+<span class="fc" id="L1462">            break;</span>
         case NONE:
             // Use the existing escaping code
-<span class="fc" id="L1432">            printWithEscapes(value, out);</span>
-<span class="fc" id="L1433">            return;</span>
+<span class="fc" id="L1465">            printWithEscapes(value, out);</span>
+<span class="fc" id="L1466">            return;</span>
         case MINIMAL:
-<span class="fc bfc" id="L1435" title="All 2 branches covered.">            if (len &lt;= 0) {</span>
+<span class="fc bfc" id="L1468" 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="L1440" title="All 2 branches covered.">                if (newRecord) {</span>
-<span class="fc" id="L1441">                    quote = true;</span>
+<span class="fc bfc" id="L1473" title="All 2 branches covered.">                if (newRecord) {</span>
+<span class="fc" id="L1474">                    quote = true;</span>
                 }
             } else {
-<span class="fc" id="L1444">                char c = value.charAt(pos);</span>
+<span class="fc" id="L1477">                char c = value.charAt(pos);</span>
 
-<span class="fc bfc" id="L1446" title="All 2 branches covered.">                if (c &lt;= COMMENT) {</span>
+<span class="fc bfc" id="L1479" 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="L1450">                    quote = true;</span>
+<span class="fc" id="L1483">                    quote = true;</span>
                 } else {
-<span class="fc bfc" id="L1452" title="All 2 branches covered.">                    while (pos &lt; end) {</span>
-<span class="fc" id="L1453">                        c = value.charAt(pos);</span>
-<span class="fc bfc" id="L1454" title="All 8 branches covered.">                        if (c == LF || c == CR || c == quoteChar || c == delimChar) {</span>
-<span class="fc" id="L1455">                            quote = true;</span>
-<span class="fc" id="L1456">                            break;</span>
+<span class="fc bfc" id="L1485" title="All 2 branches covered.">                    while (pos &lt; end) {</span>
+<span class="fc" id="L1486">                        c = value.charAt(pos);</span>
+<span class="fc bfc" id="L1487" title="All 10 branches covered.">                        if (c == LF || c == CR || c == quoteChar || c == delimChar || c == escapeChar) {</span>
+<span class="fc" id="L1488">                            quote = true;</span>
+<span class="fc" id="L1489">                            break;</span>
                         }
-<span class="fc" id="L1458">                        pos++;</span>
+<span class="fc" id="L1491">                        pos++;</span>
                     }
 
-<span class="fc bfc" id="L1461" title="All 2 branches covered.">                    if (!quote) {</span>
-<span class="fc" id="L1462">                        pos = end - 1;</span>
-<span class="fc" id="L1463">                        c = value.charAt(pos);</span>
+<span class="fc bfc" id="L1494" title="All 2 branches covered.">                    if (!quote) {</span>
+<span class="fc" id="L1495">                        pos = end - 1;</span>
+<span class="fc" id="L1496">                        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="L1466" title="All 2 branches covered.">                        if (c &lt;= SP) {</span>
-<span class="fc" id="L1467">                            quote = true;</span>
+<span class="fc bfc" id="L1499" title="All 2 branches covered.">                        if (c &lt;= SP) {</span>
+<span class="fc" id="L1500">                            quote = true;</span>
                         }
                     }
                 }
             }
 
-<span class="fc bfc" id="L1473" title="All 2 branches covered.">            if (!quote) {</span>
+<span class="fc bfc" id="L1506" title="All 2 branches covered.">            if (!quote) {</span>
                 // no encapsulation needed - write out the original value
-<span class="fc" id="L1475">                out.append(value, start, end);</span>
-<span class="fc" id="L1476">                return;</span>
+<span class="fc" id="L1508">                out.append(value, start, end);</span>
+<span class="fc" id="L1509">                return;</span>
             }
             break;
         default:
-<span class="nc" id="L1480">            throw new IllegalStateException(&quot;Unexpected Quote value: &quot; + quoteModePolicy);</span>
+<span class="nc" id="L1513">            throw new IllegalStateException(&quot;Unexpected Quote value: &quot; + quoteModePolicy);</span>
         }
 
-<span class="fc bfc" id="L1483" title="All 2 branches covered.">        if (!quote) {</span>
+<span class="fc bfc" id="L1516" title="All 2 branches covered.">        if (!quote) {</span>
             // no encapsulation needed - write out the original value
-<span class="fc" id="L1485">            out.append(value, start, end);</span>
-<span class="fc" id="L1486">            return;</span>
+<span class="fc" id="L1518">            out.append(value, start, end);</span>
+<span class="fc" id="L1519">            return;</span>
         }
 
         // we hit something that needed encapsulation
-<span class="fc" id="L1490">        out.append(quoteChar);</span>
+<span class="fc" id="L1523">        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="L1494" title="All 2 branches covered.">        while (pos &lt; end) {</span>
-<span class="fc" id="L1495">            final char c = value.charAt(pos);</span>
-<span class="fc bfc" id="L1496" title="All 2 branches covered.">            if (c == quoteChar) {</span>
+<span class="fc bfc" id="L1527" title="All 2 branches covered.">        while (pos &lt; end) {</span>
+<span class="fc" id="L1528">            final char c = value.charAt(pos);</span>
+<span class="fc bfc" id="L1529" title="All 4 branches covered.">            if (c == quoteChar || c == escapeChar) {</span>
                 // write out the chunk up until this point
-
-                // add 1 to the length to write out the encapsulator also
-<span class="fc" id="L1500">                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="L1503">                start = pos;</span>
+<span class="fc" id="L1531">                out.append(value, start, pos);</span>
+<span class="fc" id="L1532">                out.append(escapeChar); // now output the escape</span>
+<span class="fc" id="L1533">                start = pos; // and restart with the matched char</span>
             }
-<span class="fc" id="L1505">            pos++;</span>
-<span class="fc" id="L1506">        }</span>
+<span class="fc" id="L1535">            pos++;</span>
+<span class="fc" id="L1536">        }</span>
 
         // write the last segment
-<span class="fc" id="L1509">        out.append(value, start, pos);</span>
-<span class="fc" id="L1510">        out.append(quoteChar);</span>
-<span class="fc" id="L1511">    }</span>
+<span class="fc" id="L1539">        out.append(value, start, pos);</span>
+<span class="fc" id="L1540">        out.append(quoteChar);</span>
+<span class="fc" id="L1541">    }</span>
 
     /**
      * Always use quotes unless QuoteMode is NONE, so we not have to look ahead.
@@ -1517,115 +1547,119 @@ public final class CSVFormat implements
      */
     private void printWithQuotes(final Reader reader, final Appendable out) throws IOException {
 
-<span class="pc bpc" id="L1520" title="1 of 2 branches missed.">        if (getQuoteMode() == QuoteMode.NONE) {</span>
-<span class="nc" id="L1521">            printWithEscapes(reader, out);</span>
-<span class="nc" id="L1522">            return;</span>
+<span class="pc bpc" id="L1550" title="1 of 2 branches missed.">        if (getQuoteMode() == QuoteMode.NONE) {</span>
+<span class="nc" id="L1551">            printWithEscapes(reader, out);</span>
+<span class="nc" id="L1552">            return;</span>
         }
 
-<span class="fc" id="L1525">        int pos = 0;</span>
+<span class="fc" id="L1555">        int pos = 0;</span>
 
-<span class="fc" id="L1527">        final char quote = getQuoteCharacter().charValue();</span>
-<span class="fc" id="L1528">        final StringBuilder builder = new StringBuilder(IOUtils.DEFAULT_BUFFER_SIZE);</span>
+<span class="fc" id="L1557">        final char quote = getQuoteCharacter().charValue();</span>
+<span class="fc" id="L1558">        final StringBuilder builder = new StringBuilder(IOUtils.DEFAULT_BUFFER_SIZE);</span>
 
-<span class="fc" id="L1530">        out.append(quote);</span>
+<span class="fc" id="L1560">        out.append(quote);</span>
 
         int c;
-<span class="fc bfc" id="L1533" title="All 2 branches covered.">        while (-1 != (c = reader.read())) {</span>
-<span class="fc" id="L1534">            builder.append((char) c);</span>
-<span class="fc bfc" id="L1535" title="All 2 branches covered.">            if (c == quote) {</span>
+<span class="fc bfc" id="L1563" title="All 2 branches covered.">        while (-1 != (c = reader.read())) {</span>
+<span class="fc" id="L1564">            builder.append((char) c);</span>
+<span class="fc bfc" id="L1565" title="All 2 branches covered.">            if (c == quote) {</span>
                 // write out segment up until this char
-<span class="pc bpc" id="L1537" title="1 of 2 branches missed.">                if (pos &gt; 0) {</span>
-<span class="fc" id="L1538">                    out.append(builder.substring(0, pos));</span>
-<span class="fc" id="L1539">                    builder.setLength(0);</span>
-<span class="fc" id="L1540">                    pos = -1;</span>
+<span class="pc bpc" id="L1567" title="1 of 2 branches missed.">                if (pos &gt; 0) {</span>
+<span class="fc" id="L1568">                    out.append(builder.substring(0, pos));</span>
+<span class="fc" id="L1569">                    builder.setLength(0);</span>
+<span class="fc" id="L1570">                    pos = -1;</span>
                 }
 
-<span class="fc" id="L1543">                out.append(quote);</span>
-<span class="fc" id="L1544">                out.append((char) c);</span>
+<span class="fc" id="L1573">                out.append(quote);</span>
+<span class="fc" id="L1574">                out.append((char) c);</span>
             }
-<span class="fc" id="L1546">            pos++;</span>
+<span class="fc" id="L1576">            pos++;</span>
         }
 
         // write last segment
-<span class="pc bpc" id="L1550" title="1 of 2 branches missed.">        if (pos &gt; 0) {</span>
-<span class="fc" id="L1551">            out.append(builder.substring(0, pos));</span>
+<span class="pc bpc" id="L1580" title="1 of 2 branches missed.">        if (pos &gt; 0) {</span>
+<span class="fc" id="L1581">            out.append(builder.substring(0, pos));</span>
         }
 
-<span class="fc" id="L1554">        out.append(quote);</span>
-<span class="fc" id="L1555">    }</span>
+<span class="fc" id="L1584">        out.append(quote);</span>
+<span class="fc" id="L1585">    }</span>
 
     @Override
     public String toString() {
-<span class="fc" id="L1559">        final StringBuilder sb = new StringBuilder();</span>
-<span class="fc" id="L1560">        sb.append(&quot;Delimiter=&lt;&quot;).append(delimiter).append('&gt;');</span>
-<span class="fc bfc" id="L1561" title="All 2 branches covered.">        if (isEscapeCharacterSet()) {</span>
-<span class="fc" id="L1562">            sb.append(' ');</span>
-<span class="fc" id="L1563">            sb.append(&quot;Escape=&lt;&quot;).append(escapeCharacter).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L1565" title="1 of 2 branches missed.">        if (isQuoteCharacterSet()) {</span>
-<span class="fc" id="L1566">            sb.append(' ');</span>
-<span class="fc" id="L1567">            sb.append(&quot;QuoteChar=&lt;&quot;).append(quoteCharacter).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L1569" title="All 2 branches covered.">        if (isCommentMarkerSet()) {</span>
-<span class="fc" id="L1570">            sb.append(' ');</span>
-<span class="fc" id="L1571">            sb.append(&quot;CommentStart=&lt;&quot;).append(commentMarker).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L1573" title="1 of 2 branches missed.">        if (isNullStringSet()) {</span>
-<span class="nc" id="L1574">            sb.append(' ');</span>
-<span class="nc" id="L1575">            sb.append(&quot;NullString=&lt;&quot;).append(nullString).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L1577" title="All 2 branches covered.">        if (recordSeparator != null) {</span>
-<span class="fc" id="L1578">            sb.append(' ');</span>
-<span class="fc" id="L1579">            sb.append(&quot;RecordSeparator=&lt;&quot;).append(recordSeparator).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L1581" title="All 2 branches covered.">        if (getIgnoreEmptyLines()) {</span>
-<span class="fc" id="L1582">            sb.append(&quot; EmptyLines:ignored&quot;);</span>
-        }
-<span class="fc bfc" id="L1584" title="All 2 branches covered.">        if (getIgnoreSurroundingSpaces()) {</span>
-<span class="fc" id="L1585">            sb.append(&quot; SurroundingSpaces:ignored&quot;);</span>
-        }
-<span class="pc bpc" id="L1587" title="1 of 2 branches missed.">        if (getIgnoreHeaderCase()) {</span>
-<span class="nc" id="L1588">            sb.append(&quot; IgnoreHeaderCase:ignored&quot;);</span>
-        }
-<span class="fc" id="L1590">        sb.append(&quot; SkipHeaderRecord:&quot;).append(skipHeaderRecord);</span>
-<span class="pc bpc" id="L1591" title="1 of 2 branches missed.">        if (headerComments != null) {</span>
-<span class="nc" id="L1592">            sb.append(' ');</span>
-<span class="nc" id="L1593">            sb.append(&quot;HeaderComments:&quot;).append(Arrays.toString(headerComments));</span>
-        }
-<span class="pc bpc" id="L1595" title="1 of 2 branches missed.">        if (header != null) {</span>
-<span class="nc" id="L1596">            sb.append(' ');</span>
-<span class="nc" id="L1597">            sb.append(&quot;Header:&quot;).append(Arrays.toString(header));</span>
+<span class="fc" id="L1589">        final StringBuilder sb = new StringBuilder();</span>
+<span class="fc" id="L1590">        sb.append(&quot;Delimiter=&lt;&quot;).append(delimiter).append('&gt;');</span>
+<span class="fc bfc" id="L1591" title="All 2 branches covered.">        if (isEscapeCharacterSet()) {</span>
+<span class="fc" id="L1592">            sb.append(' ');</span>
+<span class="fc" id="L1593">            sb.append(&quot;Escape=&lt;&quot;).append(escapeCharacter).append('&gt;');</span>
+        }
+<span class="pc bpc" id="L1595" title="1 of 2 branches missed.">        if (isQuoteCharacterSet()) {</span>
+<span class="fc" id="L1596">            sb.append(' ');</span>
+<span class="fc" id="L1597">            sb.append(&quot;QuoteChar=&lt;&quot;).append(quoteCharacter).append('&gt;');</span>
+        }
+<span class="pc bpc" id="L1599" title="1 of 2 branches missed.">        if (quoteMode != null) {</span>
+<span class="nc" id="L1600">            sb.append(' ');</span>
+<span class="nc" id="L1601">            sb.append(&quot;QuoteMode=&lt;&quot;).append(quoteMode).append('&gt;');</span>
+        }
+<span class="fc bfc" id="L1603" title="All 2 branches covered.">        if (isCommentMarkerSet()) {</span>
+<span class="fc" id="L1604">            sb.append(' ');</span>
+<span class="fc" id="L1605">            sb.append(&quot;CommentStart=&lt;&quot;).append(commentMarker).append('&gt;');</span>
+        }
+<span class="pc bpc" id="L1607" title="1 of 2 branches missed.">        if (isNullStringSet()) {</span>
+<span class="nc" id="L1608">            sb.append(' ');</span>
+<span class="nc" id="L1609">            sb.append(&quot;NullString=&lt;&quot;).append(nullString).append('&gt;');</span>
+        }
+<span class="fc bfc" id="L1611" title="All 2 branches covered.">        if (recordSeparator != null) {</span>
+<span class="fc" id="L1612">            sb.append(' ');</span>
+<span class="fc" id="L1613">            sb.append(&quot;RecordSeparator=&lt;&quot;).append(recordSeparator).append('&gt;');</span>
+        }
+<span class="fc bfc" id="L1615" title="All 2 branches covered.">        if (getIgnoreEmptyLines()) {</span>
+<span class="fc" id="L1616">            sb.append(&quot; EmptyLines:ignored&quot;);</span>
+        }
+<span class="fc bfc" id="L1618" title="All 2 branches covered.">        if (getIgnoreSurroundingSpaces()) {</span>
+<span class="fc" id="L1619">            sb.append(&quot; SurroundingSpaces:ignored&quot;);</span>
+        }
+<span class="pc bpc" id="L1621" title="1 of 2 branches missed.">        if (getIgnoreHeaderCase()) {</span>
+<span class="nc" id="L1622">            sb.append(&quot; IgnoreHeaderCase:ignored&quot;);</span>
+        }
+<span class="fc" id="L1624">        sb.append(&quot; SkipHeaderRecord:&quot;).append(skipHeaderRecord);</span>
+<span class="pc bpc" id="L1625" title="1 of 2 branches missed.">        if (headerComments != null) {</span>
+<span class="nc" id="L1626">            sb.append(' ');</span>
+<span class="nc" id="L1627">            sb.append(&quot;HeaderComments:&quot;).append(Arrays.toString(headerComments));</span>
+        }
+<span class="pc bpc" id="L1629" title="1 of 2 branches missed.">        if (header != null) {</span>
+<span class="nc" id="L1630">            sb.append(' ');</span>
+<span class="nc" id="L1631">            sb.append(&quot;Header:&quot;).append(Arrays.toString(header));</span>
         }
-<span class="fc" id="L1599">        return sb.toString();</span>
+<span class="fc" id="L1633">        return sb.toString();</span>
     }
 
     private String[] toStringArray(final Object[] values) {
-<span class="fc bfc" id="L1603" title="All 2 branches covered.">        if (values == null) {</span>
-<span class="fc" id="L1604">            return null;</span>
+<span class="fc bfc" id="L1637" title="All 2 branches covered.">        if (values == null) {</span>
+<span class="fc" id="L1638">            return null;</span>
         }
-<span class="fc" id="L1606">        final String[] strings = new String[values.length];</span>
-<span class="fc bfc" id="L1607" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
-<span class="fc" id="L1608">            final Object value = values[i];</span>
-<span class="fc bfc" id="L1609" title="All 2 branches covered.">            strings[i] = value == null ? null : value.toString();</span>
+<span class="fc" id="L1640">        final String[] strings = new String[values.length];</span>
+<span class="fc bfc" id="L1641" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
+<span class="fc" id="L1642">            final Object value = values[i];</span>
+<span class="fc bfc" id="L1643" title="All 2 branches covered.">            strings[i] = value == null ? null : value.toString();</span>
         }
-<span class="fc" id="L1611">        return strings;</span>
+<span class="fc" id="L1645">        return strings;</span>
     }
 
     private CharSequence trim(final CharSequence charSequence) {
-<span class="pc bpc" id="L1615" title="1 of 2 branches missed.">        if (charSequence instanceof String) {</span>
-<span class="fc" id="L1616">            return ((String) charSequence).trim();</span>
+<span class="pc bpc" id="L1649" title="1 of 2 branches missed.">        if (charSequence instanceof String) {</span>
+<span class="fc" id="L1650">            return ((String) charSequence).trim();</span>
         }
-<span class="nc" id="L1618">        final int count = charSequence.length();</span>
-<span class="nc" id="L1619">        int len = count;</span>
-<span class="nc" id="L1620">        int pos = 0;</span>
+<span class="nc" id="L1652">        final int count = charSequence.length();</span>
+<span class="nc" id="L1653">        int len = count;</span>
+<span class="nc" id="L1654">        int pos = 0;</span>
 
-<span class="nc bnc" id="L1622" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(pos) &lt;= SP) {</span>
-<span class="nc" id="L1623">            pos++;</span>
+<span class="nc bnc" id="L1656" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(pos) &lt;= SP) {</span>
+<span class="nc" id="L1657">            pos++;</span>
         }
-<span class="nc bnc" id="L1625" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(len - 1) &lt;= SP) {</span>
-<span class="nc" id="L1626">            len--;</span>
+<span class="nc bnc" id="L1659" title="All 4 branches missed.">        while (pos &lt; len &amp;&amp; charSequence.charAt(len - 1) &lt;= SP) {</span>
+<span class="nc" id="L1660">            len--;</span>
         }
-<span class="nc bnc" id="L1628" title="All 4 branches missed.">        return pos &gt; 0 || len &lt; count ? charSequence.subSequence(pos, len) : charSequence;</span>
+<span class="nc bnc" id="L1662" title="All 4 branches missed.">        return pos &gt; 0 || len &lt; count ? charSequence.subSequence(pos, len) : charSequence;</span>
     }
 
     /**
@@ -1634,50 +1668,50 @@ public final class CSVFormat implements
      * @throws IllegalArgumentException
      */
     private void validate() throws IllegalArgumentException {
-<span class="pc bpc" id="L1637" title="1 of 2 branches missed.">        if (isLineBreak(delimiter)) {</span>
-<span class="nc" id="L1638">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
+<span class="pc bpc" id="L1671" title="1 of 2 branches missed.">        if (isLineBreak(delimiter)) {</span>
+<span class="nc" id="L1672">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
         }
 
-<span class="fc bfc" id="L1641" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; delimiter == quoteCharacter.charValue()) {</span>
-<span class="fc" id="L1642">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1675" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; delimiter == quoteCharacter.charValue()) {</span>
+<span class="fc" id="L1676">            throw new IllegalArgumentException(</span>
                     &quot;The quoteChar character and the delimiter cannot be the same ('&quot; + quoteCharacter + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1646" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; delimiter == escapeCharacter.charValue()) {</span>
-<span class="fc" id="L1647">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1680" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; delimiter == escapeCharacter.charValue()) {</span>
+<span class="fc" id="L1681">            throw new IllegalArgumentException(</span>
                     &quot;The escape character and the delimiter cannot be the same ('&quot; + escapeCharacter + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L1651" title="All 4 branches covered.">        if (commentMarker != null &amp;&amp; delimiter == commentMarker.charValue()) {</span>
-<span class="fc" id="L1652">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1685" title="All 4 branches covered.">        if (commentMarker != null &amp;&amp; delimiter == commentMarker.charValue()) {</span>
+<span class="fc" id="L1686">            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="L1656" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; quoteCharacter.equals(commentMarker)) {</span>
-<span class="fc" id="L1657">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1690" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; quoteCharacter.equals(commentMarker)) {</span>
+<span class="fc" id="L1691">            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="L1661" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; escapeCharacter.equals(commentMarker)) {</span>
-<span class="fc" id="L1662">            throw new IllegalArgumentException(</span>
+<span class="fc bfc" id="L1695" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; escapeCharacter.equals(commentMarker)) {</span>
+<span class="fc" id="L1696">            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="L1666" title="All 4 branches covered.">        if (escapeCharacter == null &amp;&amp; quoteMode == QuoteMode.NONE) {</span>
-<span class="fc" id="L1667">            throw new IllegalArgumentException(&quot;No quotes mode set but no escape character is set&quot;);</span>
+<span class="fc bfc" id="L1700" title="All 4 branches covered.">        if (escapeCharacter == null &amp;&amp; quoteMode == QuoteMode.NONE) {</span>
+<span class="fc" id="L1701">            throw new IllegalArgumentException(&quot;No quotes mode set but no escape character is set&quot;);</span>
         }
 
         // validate header
-<span class="fc bfc" id="L1671" title="All 2 branches covered.">        if (header != null) {</span>
-<span class="fc" id="L1672">            final Set&lt;String&gt; dupCheck = new HashSet&lt;&gt;();</span>
-<span class="fc bfc" id="L1673" title="All 2 branches covered.">            for (final String hdr : header) {</span>
-<span class="fc bfc" id="L1674" title="All 2 branches covered.">                if (!dupCheck.add(hdr)) {</span>
-<span class="fc" id="L1675">                    throw new IllegalArgumentException(</span>
-<span class="fc" id="L1676">                            &quot;The header contains a duplicate entry: '&quot; + hdr + &quot;' in &quot; + Arrays.toString(header));</span>
+<span class="fc bfc" id="L1705" title="All 4 branches covered.">        if (header != null &amp;&amp; !allowDuplicateHeaderNames) {</span>
+<span class="fc" id="L1706">            final Set&lt;String&gt; dupCheck = new HashSet&lt;&gt;();</span>
+<span class="fc bfc" id="L1707" title="All 2 branches covered.">            for (final String hdr : header) {</span>
+<span class="fc bfc" id="L1708" title="All 2 branches covered.">                if (!dupCheck.add(hdr)) {</span>
+<span class="fc" id="L1709">                    throw new IllegalArgumentException(</span>
+<span class="fc" id="L1710">                            &quot;The header contains a duplicate entry: '&quot; + hdr + &quot;' in &quot; + Arrays.toString(header));</span>
                 }
             }
         }
-<span class="fc" id="L1680">    }</span>
+<span class="fc" id="L1714">    }</span>
 
     /**
      * Returns a new {@code CSVFormat} that allows duplicate header names.
@@ -1686,7 +1720,7 @@ public final class CSVFormat implements
      * @since 1.7
      */
     public CSVFormat withAllowDuplicateHeaderNames() {
-<span class="nc" id="L1689">    	return withAllowDuplicateHeaderNames(true);</span>
+<span class="fc" id="L1723">        return withAllowDuplicateHeaderNames(true);</span>
     }
 
     /**
@@ -1697,7 +1731,7 @@ public final class CSVFormat implements
      * @since 1.7
      */
     public CSVFormat withAllowDuplicateHeaderNames(final boolean allowDuplicateHeaderNames) {
-<span class="fc" id="L1700">    	return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1734">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush,
                 allowDuplicateHeaderNames);
@@ -1711,7 +1745,7 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withAllowMissingColumnNames() {
-<span class="fc" id="L1714">        return this.withAllowMissingColumnNames(true);</span>
+<span class="fc" id="L1748">        return this.withAllowMissingColumnNames(true);</span>
     }
 
     /**
@@ -1723,7 +1757,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="L1726">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1760">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush,
                 allowDuplicateHeaderNames);
@@ -1739,7 +1773,7 @@ public final class CSVFormat implements
      * @since 1.6
      */
     public CSVFormat withAutoFlush(final boolean autoFlush) {
-<span class="fc" id="L1742">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1776">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush,
                 allowDuplicateHeaderNames);
@@ -1757,7 +1791,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="L1760">        return withCommentMarker(Character.valueOf(commentMarker));</span>
+<span class="fc" id="L1794">        return withCommentMarker(Character.valueOf(commentMarker));</span>
     }
 
     /**
@@ -1772,10 +1806,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="L1775" title="All 2 branches covered.">        if (isLineBreak(commentMarker)) {</span>
-<span class="fc" id="L1776">            throw new IllegalArgumentException(&quot;The comment start marker character cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1809" title="All 2 branches covered.">        if (isLineBreak(commentMarker)) {</span>
+<span class="fc" id="L1810">            throw new IllegalArgumentException(&quot;The comment start marker character cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L1778">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1812">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush,
                 allowDuplicateHeaderNames);
@@ -1791,10 +1825,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="L1794" title="All 2 branches covered.">        if (isLineBreak(delimiter)) {</span>
-<span class="fc" id="L1795">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1828" title="All 2 branches covered.">        if (isLineBreak(delimiter)) {</span>
+<span class="fc" id="L1829">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L1797">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1831">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush,
                 allowDuplicateHeaderNames);
@@ -1810,7 +1844,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="L1813">        return withEscape(Character.valueOf(escape));</span>
+<span class="fc" id="L1847">        return withEscape(Character.valueOf(escape));</span>
     }
 
     /**
@@ -1823,10 +1857,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="L1826" title="All 2 branches covered.">        if (isLineBreak(escape)) {</span>
-<span class="fc" id="L1827">            throw new IllegalArgumentException(&quot;The escape character cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1860" title="All 2 branches covered.">        if (isLineBreak(escape)) {</span>
+<span class="fc" id="L1861">            throw new IllegalArgumentException(&quot;The escape character cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L1829">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escape, ignoreSurroundingSpaces,</span>
+<span class="fc" id="L1863">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escape, ignoreSurroundingSpaces,</span>
                 ignoreEmptyLines, recordSeparator, nullString, headerComments, header, skipHeaderRecord,
                 allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush,
                 allowDuplicateHeaderNames);
@@ -1849,7 +1883,7 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public CSVFormat withFirstRecordAsHeader() {
-<span class="fc" id="L1852">        return withHeader().withSkipHeaderRecord();</span>
+<span class="fc" id="L1886">        return withHeader().withSkipHeaderRecord();</span>
     }
 
     /**
@@ -1880,15 +1914,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="L1883">        String[] header = null;</span>
-<span class="pc bpc" id="L1884" title="1 of 2 branches missed.">        if (headerEnum != null) {</span>
-<span class="fc" id="L1885">            final Enum&lt;?&gt;[] enumValues = headerEnum.getEnumConstants();</span>
-<span class="fc" id="L1886">            header = new String[enumValues.length];</span>
-<span class="fc bfc" id="L1887" title="All 2 branches covered.">            for (int i = 0; i &lt; enumValues.length; i++) {</span>
-<span class="fc" id="L1888">                header[i] = enumValues[i].name();</span>
+<span class="fc" id="L1917">        String[] header = null;</span>
+<span class="pc bpc" id="L1918" title="1 of 2 branches missed.">        if (headerEnum != null) {</span>
+<span class="fc" id="L1919">            final Enum&lt;?&gt;[] enumValues = headerEnum.getEnumConstants();</span>
+<span class="fc" id="L1920">            header = new String[enumValues.length];</span>
+<span class="fc bfc" id="L1921" title="All 2 branches covered.">            for (int i = 0; i &lt; enumValues.length; i++) {</span>
+<span class="fc" id="L1922">                header[i] = enumValues[i].name();</span>
             }
         }
-<span class="fc" id="L1891">        return withHeader(header);</span>
+<span class="fc" id="L1925">        return withHeader(header);</span>
     }
 
     /**
@@ -1918,7 +1952,7 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withHeader(final ResultSet resultSet) throws SQLException {
-<span class="pc bpc" id="L1921" title="1 of 2 branches missed.">        return withHeader(resultSet != null ? resultSet.getMetaData() : null);</span>
+<span class="pc bpc" id="L1955" title="1 of 2 branches missed.">        return withHeader(resultSet != null ? resultSet.getMetaData() : null);</span>
     }
 
     /**
@@ -1948,15 +1982,15 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withHeader(final ResultSetMetaData metaData) throws SQLException {
-<span class="fc" id="L1951">        String[] labels = null;</span>
-<span class="pc bpc" id="L1952" title="1 of 2 branches missed.">        if (metaData != null) {</span>
-<span class="fc" id="L1953">            final int columnCount = metaData.getColumnCount();</span>
-<span class="fc" id="L1954">            labels = new String[columnCount];</span>
-<span class="fc bfc" id="L1955" title="All 2 branches covered.">            for (int i = 0; i &lt; columnCount; i++) {</span>
-<span class="fc" id="L1956">                labels[i] = metaData.getColumnLabel(i + 1);</span>
+<span class="fc" id="L1985">        String[] labels = null;</span>
+<span class="pc bpc" id="L1986" title="1 of 2 branches missed.">        if (metaData != null) {</span>
+<span class="fc" id="L1987">            final int columnCount = metaData.getColumnCount();</span>
+<span class="fc" id="L1988">            labels = new String[columnCount];</span>
+<span class="fc bfc" id="L1989" title="All 2 branches covered.">            for (int i = 0; i &lt; columnCount; i++) {</span>
+<span class="fc" id="L1990">                labels[i] = metaData.getColumnLabel(i + 1);</span>
             }
         }
-<span class="fc" id="L1959">        return withHeader(labels);</span>
+<span class="fc" id="L1993">        return withHeader(labels);</span>
     }
 
     /**
@@ -1983,7 +2017,7 @@ public final class CSVFormat implements
      * @see #withSkipHeaderRecord(boolean)
      */
     public CSVFormat withHeader(final String... header) {
-<span class="fc" id="L1986">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L2020">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush,
                 allowDuplicateHeaderNames);
@@ -2005,7 +2039,7 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withHeaderComments(final Object... headerComments) {
-<span class="fc" id="L2008">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L2042">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush,
                 allowDuplicateHeaderNames);
@@ -2019,7 +2053,7 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withIgnoreEmptyLines() {
-<span class="fc" id="L2022">        return this.withIgnoreEmptyLines(true);</span>
+<span class="fc" id="L2056">        return this.withIgnoreEmptyLines(true);</span>
     }
 
     /**
@@ -2031,7 +2065,7 @@ public final class CSVFormat implements
      * @return A new CSVFormat that is equal to this but with the specified empty line skipping behavior.
      */
     public CSVFormat withIgnoreEmptyLines(final boolean ignoreEmptyLines) {
-<span class="fc" id="L2034">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L2068">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush,
                 allowDuplicateHeaderNames);
@@ -2045,7 +2079,7 @@ public final class CSVFormat implements
      * @since 1.3
      */
     public CSVFormat withIgnoreHeaderCase() {
-<span class="fc" id="L2048">        return this.withIgnoreHeaderCase(true);</span>
+<span class="fc" id="L2082">        return this.withIgnoreHeaderCase(true);</span>
     }
 

[... 183 lines stripped ...]