commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r987826 [25/48] - 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/ jacoco/ jacoco/.resources/ jac...
Date Mon, 09 May 2016 17:27:47 GMT
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 Mon May  9 17:27:44 2016
@@ -23,6 +23,7 @@ import static org.apache.commons.csv.Con
 import static org.apache.commons.csv.Constants.CRLF;
 import static org.apache.commons.csv.Constants.DOUBLE_QUOTE_CHAR;
 import static org.apache.commons.csv.Constants.LF;
+import static org.apache.commons.csv.Constants.PIPE;
 import static org.apache.commons.csv.Constants.TAB;
 
 import java.io.IOException;
@@ -143,73 +144,69 @@ import java.util.Set;
  * This class is immutable.
  * </p>
  *
- * @version $Id: CSVFormat.java 1695190 2015-08-11 02:14:33Z ggregory $
+ * @version $Id: CSVFormat.java 1742506 2016-05-06 07:07:43Z britter $
  */
 public final class CSVFormat implements Serializable {
 
     /**
      * Predefines formats.
-     * 
+     *
      * @since 1.2
      */
-<span class="fc" id="L155">    public static enum Predefined {</span>
+<span class="fc" id="L156">    public enum Predefined {</span>
 
         /**
          * @see CSVFormat#DEFAULT
          */
-<span class="fc" id="L160">        Default(CSVFormat.DEFAULT), </span>
+<span class="fc" id="L161">        Default(CSVFormat.DEFAULT),</span>
 
         /**
          * @see CSVFormat#EXCEL
          */
-<span class="fc" id="L165">        Excel(CSVFormat.EXCEL), </span>
+<span class="fc" id="L166">        Excel(CSVFormat.EXCEL),</span>
+
+        /**
+         * @see CSVFormat#INFORMIX_UNLOAD
+         * @since 1.3
+         */
+<span class="fc" id="L172">        InformixUnload(CSVFormat.INFORMIX_UNLOAD),</span>
+
+        /**
+         * @see CSVFormat#INFORMIX_UNLOAD_CSV
+         * @since 1.3
+         */
+<span class="fc" id="L178">        InformixUnloadCsv(CSVFormat.INFORMIX_UNLOAD_CSV),</span>
 
         /**
          * @see CSVFormat#MYSQL
          */
-<span class="fc" id="L170">        MySQL(CSVFormat.MYSQL), </span>
+<span class="fc" id="L183">        MySQL(CSVFormat.MYSQL),</span>
 
         /**
          * @see CSVFormat#RFC4180
          */
-<span class="fc" id="L175">        RFC4180(CSVFormat.RFC4180),</span>
+<span class="fc" id="L188">        RFC4180(CSVFormat.RFC4180),</span>
 
         /**
          * @see CSVFormat#TDF
          */
-<span class="fc" id="L180">        TDF(CSVFormat.TDF);</span>
+<span class="fc" id="L193">        TDF(CSVFormat.TDF);</span>
 
         private final CSVFormat format;
 
-<span class="fc" id="L184">        private Predefined(CSVFormat format) {</span>
-<span class="fc" id="L185">            this.format = format;</span>
-<span class="fc" id="L186">        }</span>
-        
+<span class="fc" id="L197">        Predefined(final CSVFormat format) {</span>
+<span class="fc" id="L198">            this.format = format;</span>
+<span class="fc" id="L199">        }</span>
+
         /**
          * Gets the format.
-         * 
+         *
          * @return the format.
          */
         public CSVFormat getFormat() {
-<span class="fc" id="L194">            return format;</span>
+<span class="fc" id="L207">            return format;</span>
         }
-    };
-    
-    private static final long serialVersionUID = 1L;
-
-    private final char delimiter;
-    private final Character quoteCharacter; // null if quoting is disabled
-    private final QuoteMode quoteMode;
-    private final Character commentMarker; // null if commenting is disabled
-    private final Character escapeCharacter; // null if escaping is disabled
-    private final boolean ignoreSurroundingSpaces; // Should leading/trailing spaces be ignored around values?
-    private final boolean allowMissingColumnNames;
-    private final boolean ignoreEmptyLines;
-    private final String recordSeparator; // for outputs
-    private final String nullString; // the string to be used for null values
-    private final String[] header; // array of header column names
-    private final String[] headerComments; // array of header comment lines
-    private final boolean skipHeaderRecord;
+    }
 
     /**
      * Standard comma separated format, as for {@link #RFC4180} but allowing empty lines.
@@ -223,26 +220,11 @@ public final class CSVFormat implements
      * &lt;li&gt;withRecordSeparator(&quot;\r\n&quot;)&lt;/li&gt;
      * &lt;li&gt;withIgnoreEmptyLines(true)&lt;/li&gt;
      * &lt;/ul&gt;
-     * @see Predefined#Default
-     */
-<span class="fc" id="L228">    public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true,</span>
-            CRLF, null, null, null, false, false);
-
-    /**
-     * Comma separated format as defined by &lt;a href=&quot;http://tools.ietf.org/html/rfc4180&quot;&gt;RFC 4180&lt;/a&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(&quot;\r\n&quot;)&lt;/li&gt;
-     * &lt;li&gt;withIgnoreEmptyLines(false)&lt;/li&gt;
-     * &lt;/ul&gt;
-     * @see Predefined#RFC4180
+     * @see Predefined#Default
      */
-<span class="fc" id="L245">    public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false);</span>
+<span class="fc" id="L226">    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);
 
     /**
      * Excel file format (using a comma as the value delimiter). Note that the actual value delimiter used by Excel is
@@ -270,32 +252,70 @@ public final class CSVFormat implements
      * Note: this is currently like {@link #RFC4180} plus {@link #withAllowMissingColumnNames(boolean)
      * withAllowMissingColumnNames(true)}.
      * &lt;/p&gt;
+     *
      * @see Predefined#Excel
      */
-<span class="fc" id="L275">    public static final CSVFormat EXCEL = DEFAULT.withIgnoreEmptyLines(false).withAllowMissingColumnNames();</span>
+<span class="fc" id="L258">    public static final CSVFormat EXCEL = DEFAULT.withIgnoreEmptyLines(false).withAllowMissingColumnNames();</span>
 
     /**
-     * Tab-delimited format.
+     * Default Informix CSV UNLOAD format used by the {@code UNLOAD TO file_name} operation.
+     *
+     * &lt;p&gt;
+     * This is a comma-delimited format with a LF character as the line separator. Values are not quoted and special
+     * characters are escaped with {@code '\'}. 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(&quot;\r\n&quot;)&lt;/li&gt;
-     * &lt;li&gt;withIgnoreSurroundingSpaces(true)&lt;/li&gt;
+     * &lt;li&gt;withDelimiter(',')&lt;/li&gt;
+     * &lt;li&gt;withQuote(&quot;\&quot;&quot;)&lt;/li&gt;
+     * &lt;li&gt;withRecordSeparator('\n')&lt;/li&gt;
+     * &lt;li&gt;withEscape('\\')&lt;/li&gt;
      * &lt;/ul&gt;
-     * @see Predefined#TDF
+     *
+     * @see Predefined#MySQL
+     * @see &lt;a href=
+     *      &quot;http://www.ibm.com/support/knowledgecenter/SSBJG3_2.5.0/com.ibm.gen_busug.doc/c_fgl_InOutSql_UNLOAD.htm&quot;&gt;
+     *      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="L284">    public static final CSVFormat INFORMIX_UNLOAD = DEFAULT.withDelimiter(PIPE).withEscape(BACKSLASH)</span>
+<span class="fc" id="L285">            .withQuote(DOUBLE_QUOTE_CHAR).withRecordSeparator(LF);</span>
+
+    /**
+     * Default Informix CSV UNLOAD format used by the {@code UNLOAD TO file_name} operation.
+     *
+     * &lt;p&gt;
+     * This is a comma-delimited format with a LF character as the line separator. Values are not quoted and special
+     * characters are escaped with {@code '\'}. 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(',')&lt;/li&gt;
+     * &lt;li&gt;withQuote(&quot;\&quot;&quot;)&lt;/li&gt;
+     * &lt;li&gt;withRecordSeparator('\n')&lt;/li&gt;
+     * &lt;/ul&gt;
+     *
+     * @see Predefined#MySQL
+     * @see &lt;a href=
+     *      &quot;http://www.ibm.com/support/knowledgecenter/SSBJG3_2.5.0/com.ibm.gen_busug.doc/c_fgl_InOutSql_UNLOAD.htm&quot;&gt;
+     *      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 TDF = DEFAULT.withDelimiter(TAB).withIgnoreSurroundingSpaces();</span>
+<span class="fc" id="L310">    public static final CSVFormat INFORMIX_UNLOAD_CSV = DEFAULT.withDelimiter(COMMA).withQuote(DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L311">            .withRecordSeparator(LF);</span>
 
     /**
      * Default MySQL format used by the {@code SELECT INTO OUTFILE} and {@code LOAD DATA INFILE} operations.
      *
      * &lt;p&gt;
      * This is a tab-delimited format with a LF character as the line separator. Values are not quoted and special
-     * characters are escaped with '\'.
+     * characters are escaped with {@code '\'}. The default NULL string is {@code &quot;\\N&quot;}.
      * &lt;/p&gt;
      *
      * &lt;p&gt;
@@ -307,14 +327,51 @@ public final class CSVFormat implements
      * &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;/ul&gt;
      *
      * @see Predefined#MySQL
-     * @see &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.1/en/load-data.html&quot;&gt;
-     *      http://dev.mysql.com/doc/refman/5.1/en/load-data.html&lt;/a&gt;
+     * @see &lt;a href=&quot;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;
      */
-<span class="fc" id="L316">    public static final CSVFormat MYSQL = DEFAULT.withDelimiter(TAB).withEscape(BACKSLASH).withIgnoreEmptyLines(false)</span>
-<span class="fc" id="L317">            .withQuote(null).withRecordSeparator(LF);</span>
+<span class="fc" id="L337">    public static final CSVFormat MYSQL = DEFAULT.withDelimiter(TAB).withEscape(BACKSLASH).withIgnoreEmptyLines(false)</span>
+<span class="fc" id="L338">            .withQuote(null).withRecordSeparator(LF).withNullString(&quot;\\N&quot;);</span>
+
+    /**
+     * Comma separated format as defined by &lt;a href=&quot;http://tools.ietf.org/html/rfc4180&quot;&gt;RFC 4180&lt;/a&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(&quot;\r\n&quot;)&lt;/li&gt;
+     * &lt;li&gt;withIgnoreEmptyLines(false)&lt;/li&gt;
+     * &lt;/ul&gt;
+     *
+     * @see Predefined#RFC4180
+     */
+<span class="fc" id="L355">    public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false);</span>
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Tab-delimited format.
+     *
+     * &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(&quot;\r\n&quot;)&lt;/li&gt;
+     * &lt;li&gt;withIgnoreSurroundingSpaces(true)&lt;/li&gt;
+     * &lt;/ul&gt;
+     *
+     * @see Predefined#TDF
+     */
+<span class="fc" id="L374">    public static final CSVFormat TDF = DEFAULT.withDelimiter(TAB).withIgnoreSurroundingSpaces();</span>
 
     /**
      * Returns true if the given character is a line break character.
@@ -325,7 +382,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="L328" title="All 4 branches covered.">        return c == LF || c == CR;</span>
+<span class="fc bfc" id="L385" title="All 4 branches covered.">        return c == LF || c == CR;</span>
     }
 
     /**
@@ -337,7 +394,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="L340" title="All 4 branches covered.">        return c != null &amp;&amp; isLineBreak(c.charValue());</span>
+<span class="fc bfc" id="L397" title="All 4 branches covered.">        return c != null &amp;&amp; isLineBreak(c.charValue());</span>
     }
 
     /**
@@ -361,21 +418,54 @@ public final class CSVFormat implements
      * @see #TDF
      */
     public static CSVFormat newFormat(final char delimiter) {
-<span class="fc" id="L364">        return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false);</span>
+<span class="fc" id="L421">        return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false,</span>
+                false, false, false);
     }
 
     /**
      * Gets one of the predefined formats from {@link CSVFormat.Predefined}.
-     * 
+     *
      * @param format
      *            name
      * @return one of the predefined formats
      * @since 1.2
      */
     public static CSVFormat valueOf(final String format) {
-<span class="fc" id="L376">        return CSVFormat.Predefined.valueOf(format).getFormat();</span>
+<span class="fc" id="L434">        return CSVFormat.Predefined.valueOf(format).getFormat();</span>
     }
 
+    private final boolean allowMissingColumnNames;
+
+    private final Character commentMarker; // null if commenting is disabled
+
+    private final char delimiter;
+
+    private final Character escapeCharacter; // null if escaping is disabled
+
+    private final String[] header; // array of header column names
+
+    private final String[] headerComments; // array of header comment lines
+
+    private final boolean ignoreEmptyLines;
+
+    private final boolean ignoreHeaderCase; // should ignore header names case
+
+    private final boolean ignoreSurroundingSpaces; // Should leading/trailing spaces be ignored around values?
+
+    private final String nullString; // the string to be used for null values
+
+    private final Character quoteCharacter; // null if quoting is disabled
+
+    private final QuoteMode quoteMode;
+
+    private final String recordSeparator; // for outputs
+
+    private final boolean skipHeaderRecord;
+
+    private final boolean trailingDelimiter;
+
+    private final boolean trim;
+
     /**
      * Creates a customized CSV format.
      *
@@ -405,6 +495,11 @@ public final class CSVFormat implements
      *            TODO
      * @param allowMissingColumnNames
      *            TODO
+     * @param ignoreHeaderCase
+     *            TODO
+     * @param trim
+     *            TODO
+     * @param trailingDelimiter TODO
      * @throws IllegalArgumentException
      *             if the delimiter is a line break character
      */
@@ -412,102 +507,94 @@ public final class CSVFormat implements
             final Character commentStart, final Character escape, final boolean ignoreSurroundingSpaces,
             final boolean ignoreEmptyLines, final String recordSeparator, final String nullString,
             final Object[] headerComments, final String[] header, final boolean skipHeaderRecord,
-<span class="fc" id="L415">            final boolean allowMissingColumnNames) {</span>
-<span class="fc" id="L416">        this.delimiter = delimiter;</span>
-<span class="fc" id="L417">        this.quoteCharacter = quoteChar;</span>
-<span class="fc" id="L418">        this.quoteMode = quoteMode;</span>
-<span class="fc" id="L419">        this.commentMarker = commentStart;</span>
-<span class="fc" id="L420">        this.escapeCharacter = escape;</span>
-<span class="fc" id="L421">        this.ignoreSurroundingSpaces = ignoreSurroundingSpaces;</span>
-<span class="fc" id="L422">        this.allowMissingColumnNames = allowMissingColumnNames;</span>
-<span class="fc" id="L423">        this.ignoreEmptyLines = ignoreEmptyLines;</span>
-<span class="fc" id="L424">        this.recordSeparator = recordSeparator;</span>
-<span class="fc" id="L425">        this.nullString = nullString;</span>
-<span class="fc" id="L426">        this.headerComments = toStringArray(headerComments);</span>
-<span class="fc bfc" id="L427" title="All 2 branches covered.">        this.header = header == null ? null : header.clone();</span>
-<span class="fc" id="L428">        this.skipHeaderRecord = skipHeaderRecord;</span>
-<span class="fc" id="L429">        validate();</span>
-<span class="fc" id="L430">    }</span>
-
-    private String[] toStringArray(final Object[] values) {
-<span class="fc bfc" id="L433" title="All 2 branches covered.">        if (values == null) {</span>
-<span class="fc" id="L434">            return null;</span>
-        }
-<span class="fc" id="L436">        final String[] strings = new String[values.length];</span>
-<span class="fc bfc" id="L437" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
-<span class="fc" id="L438">            final Object value = values[i];</span>
-<span class="pc bpc" id="L439" title="1 of 2 branches missed.">            strings[i] = value == null ? null : value.toString();</span>
-        }
-<span class="fc" id="L441">        return strings;</span>
-    }
+            final boolean allowMissingColumnNames, final boolean ignoreHeaderCase, final boolean trim,
+<span class="fc" id="L511">            final boolean trailingDelimiter) {</span>
+<span class="fc" id="L512">        this.delimiter = delimiter;</span>
+<span class="fc" id="L513">        this.quoteCharacter = quoteChar;</span>
+<span class="fc" id="L514">        this.quoteMode = quoteMode;</span>
+<span class="fc" id="L515">        this.commentMarker = commentStart;</span>
+<span class="fc" id="L516">        this.escapeCharacter = escape;</span>
+<span class="fc" id="L517">        this.ignoreSurroundingSpaces = ignoreSurroundingSpaces;</span>
+<span class="fc" id="L518">        this.allowMissingColumnNames = allowMissingColumnNames;</span>
+<span class="fc" id="L519">        this.ignoreEmptyLines = ignoreEmptyLines;</span>
+<span class="fc" id="L520">        this.recordSeparator = recordSeparator;</span>
+<span class="fc" id="L521">        this.nullString = nullString;</span>
+<span class="fc" id="L522">        this.headerComments = toStringArray(headerComments);</span>
+<span class="fc bfc" id="L523" title="All 2 branches covered.">        this.header = header == null ? null : header.clone();</span>
+<span class="fc" id="L524">        this.skipHeaderRecord = skipHeaderRecord;</span>
+<span class="fc" id="L525">        this.ignoreHeaderCase = ignoreHeaderCase;</span>
+<span class="fc" id="L526">        this.trailingDelimiter = trailingDelimiter;</span>
+<span class="fc" id="L527">        this.trim = trim;</span>
+<span class="fc" id="L528">        validate();</span>
+<span class="fc" id="L529">    }</span>
 
     @Override
     public boolean equals(final Object obj) {
-<span class="fc bfc" id="L446" title="All 2 branches covered.">        if (this == obj) {</span>
-<span class="fc" id="L447">            return true;</span>
+<span class="fc bfc" id="L533" title="All 2 branches covered.">        if (this == obj) {</span>
+<span class="fc" id="L534">            return true;</span>
         }
-<span class="fc bfc" id="L449" title="All 2 branches covered.">        if (obj == null) {</span>
-<span class="fc" id="L450">            return false;</span>
+<span class="fc bfc" id="L536" title="All 2 branches covered.">        if (obj == null) {</span>
+<span class="fc" id="L537">            return false;</span>
         }
-<span class="fc bfc" id="L452" title="All 2 branches covered.">        if (getClass() != obj.getClass()) {</span>
-<span class="fc" id="L453">            return false;</span>
+<span class="fc bfc" id="L539" title="All 2 branches covered.">        if (getClass() != obj.getClass()) {</span>
+<span class="fc" id="L540">            return false;</span>
         }
 
-<span class="fc" id="L456">        final CSVFormat other = (CSVFormat) obj;</span>
-<span class="fc bfc" id="L457" title="All 2 branches covered.">        if (delimiter != other.delimiter) {</span>
-<span class="fc" id="L458">            return false;</span>
+<span class="fc" id="L543">        final CSVFormat other = (CSVFormat) obj;</span>
+<span class="fc bfc" id="L544" title="All 2 branches covered.">        if (delimiter != other.delimiter) {</span>
+<span class="fc" id="L545">            return false;</span>
         }
-<span class="fc bfc" id="L460" title="All 2 branches covered.">        if (quoteMode != other.quoteMode) {</span>
-<span class="fc" id="L461">            return false;</span>
+<span class="fc bfc" id="L547" title="All 2 branches covered.">        if (quoteMode != other.quoteMode) {</span>
+<span class="fc" id="L548">            return false;</span>
         }
-<span class="pc bpc" id="L463" title="1 of 2 branches missed.">        if (quoteCharacter == null) {</span>
-<span class="nc bnc" id="L464" title="All 2 branches missed.">            if (other.quoteCharacter != null) {</span>
-<span class="nc" id="L465">                return false;</span>
+<span class="pc bpc" id="L550" title="1 of 2 branches missed.">        if (quoteCharacter == null) {</span>
+<span class="nc bnc" id="L551" title="All 2 branches missed.">            if (other.quoteCharacter != null) {</span>
+<span class="nc" id="L552">                return false;</span>
             }
-<span class="fc bfc" id="L467" title="All 2 branches covered.">        } else if (!quoteCharacter.equals(other.quoteCharacter)) {</span>
-<span class="fc" id="L468">            return false;</span>
+<span class="fc bfc" id="L554" title="All 2 branches covered.">        } else if (!quoteCharacter.equals(other.quoteCharacter)) {</span>
+<span class="fc" id="L555">            return false;</span>
         }
-<span class="fc bfc" id="L470" title="All 2 branches covered.">        if (commentMarker == null) {</span>
-<span class="pc bpc" id="L471" title="1 of 2 branches missed.">            if (other.commentMarker != null) {</span>
-<span class="nc" id="L472">                return false;</span>
+<span class="fc bfc" id="L557" title="All 2 branches covered.">        if (commentMarker == null) {</span>
+<span class="pc bpc" id="L558" title="1 of 2 branches missed.">            if (other.commentMarker != null) {</span>
+<span class="nc" id="L559">                return false;</span>
             }
-<span class="fc bfc" id="L474" title="All 2 branches covered.">        } else if (!commentMarker.equals(other.commentMarker)) {</span>
-<span class="fc" id="L475">            return false;</span>
+<span class="fc bfc" id="L561" title="All 2 branches covered.">        } else if (!commentMarker.equals(other.commentMarker)) {</span>
+<span class="fc" id="L562">            return false;</span>
         }
-<span class="fc bfc" id="L477" title="All 2 branches covered.">        if (escapeCharacter == null) {</span>
-<span class="pc bpc" id="L478" title="1 of 2 branches missed.">            if (other.escapeCharacter != null) {</span>
-<span class="nc" id="L479">                return false;</span>
+<span class="fc bfc" id="L564" title="All 2 branches covered.">        if (escapeCharacter == null) {</span>
+<span class="pc bpc" id="L565" title="1 of 2 branches missed.">            if (other.escapeCharacter != null) {</span>
+<span class="nc" id="L566">                return false;</span>
             }
-<span class="fc bfc" id="L481" title="All 2 branches covered.">        } else if (!escapeCharacter.equals(other.escapeCharacter)) {</span>
-<span class="fc" id="L482">            return false;</span>
+<span class="fc bfc" id="L568" title="All 2 branches covered.">        } else if (!escapeCharacter.equals(other.escapeCharacter)) {</span>
+<span class="fc" id="L569">            return false;</span>
         }
-<span class="fc bfc" id="L484" title="All 2 branches covered.">        if (nullString == null) {</span>
-<span class="pc bpc" id="L485" title="1 of 2 branches missed.">            if (other.nullString != null) {</span>
-<span class="nc" id="L486">                return false;</span>
+<span class="fc bfc" id="L571" title="All 2 branches covered.">        if (nullString == null) {</span>
+<span class="pc bpc" id="L572" title="1 of 2 branches missed.">            if (other.nullString != null) {</span>
+<span class="nc" id="L573">                return false;</span>
             }
-<span class="fc bfc" id="L488" title="All 2 branches covered.">        } else if (!nullString.equals(other.nullString)) {</span>
-<span class="fc" id="L489">            return false;</span>
+<span class="fc bfc" id="L575" title="All 2 branches covered.">        } else if (!nullString.equals(other.nullString)) {</span>
+<span class="fc" id="L576">            return false;</span>
         }
-<span class="fc bfc" id="L491" title="All 2 branches covered.">        if (!Arrays.equals(header, other.header)) {</span>
-<span class="fc" id="L492">            return false;</span>
+<span class="fc bfc" id="L578" title="All 2 branches covered.">        if (!Arrays.equals(header, other.header)) {</span>
+<span class="fc" id="L579">            return false;</span>
         }
-<span class="fc bfc" id="L494" title="All 2 branches covered.">        if (ignoreSurroundingSpaces != other.ignoreSurroundingSpaces) {</span>
-<span class="fc" id="L495">            return false;</span>
+<span class="fc bfc" id="L581" title="All 2 branches covered.">        if (ignoreSurroundingSpaces != other.ignoreSurroundingSpaces) {</span>
+<span class="fc" id="L582">            return false;</span>
         }
-<span class="fc bfc" id="L497" title="All 2 branches covered.">        if (ignoreEmptyLines != other.ignoreEmptyLines) {</span>
-<span class="fc" id="L498">            return false;</span>
+<span class="fc bfc" id="L584" title="All 2 branches covered.">        if (ignoreEmptyLines != other.ignoreEmptyLines) {</span>
+<span class="fc" id="L585">            return false;</span>
         }
-<span class="fc bfc" id="L500" title="All 2 branches covered.">        if (skipHeaderRecord != other.skipHeaderRecord) {</span>
-<span class="fc" id="L501">            return false;</span>
+<span class="fc bfc" id="L587" title="All 2 branches covered.">        if (skipHeaderRecord != other.skipHeaderRecord) {</span>
+<span class="fc" id="L588">            return false;</span>
         }
-<span class="pc bpc" id="L503" title="1 of 2 branches missed.">        if (recordSeparator == null) {</span>
-<span class="nc bnc" id="L504" title="All 2 branches missed.">            if (other.recordSeparator != null) {</span>
-<span class="nc" id="L505">                return false;</span>
+<span class="pc bpc" id="L590" title="1 of 2 branches missed.">        if (recordSeparator == null) {</span>
+<span class="nc bnc" id="L591" title="All 2 branches missed.">            if (other.recordSeparator != null) {</span>
+<span class="nc" id="L592">                return false;</span>
             }
-<span class="fc bfc" id="L507" title="All 2 branches covered.">        } else if (!recordSeparator.equals(other.recordSeparator)) {</span>
-<span class="fc" id="L508">            return false;</span>
+<span class="fc bfc" id="L594" title="All 2 branches covered.">        } else if (!recordSeparator.equals(other.recordSeparator)) {</span>
+<span class="fc" id="L595">            return false;</span>
         }
-<span class="fc" id="L510">        return true;</span>
+<span class="fc" id="L597">        return true;</span>
     }
 
     /**
@@ -518,23 +605,33 @@ public final class CSVFormat implements
      * @return the formatted values
      */
     public String format(final Object... values) {
-<span class="fc" id="L521">        final StringWriter out = new StringWriter();</span>
+<span class="fc" id="L608">        final StringWriter out = new StringWriter();</span>
         try {
-<span class="fc" id="L523">            new CSVPrinter(out, this).printRecord(values);</span>
-<span class="fc" id="L524">            return out.toString().trim();</span>
-<span class="nc" id="L525">        } catch (final IOException e) {</span>
+<span class="fc" id="L610">            new CSVPrinter(out, this).printRecord(values);</span>
+<span class="fc" id="L611">            return out.toString().trim();</span>
+<span class="nc" id="L612">        } catch (final IOException e) {</span>
             // should not happen because a StringWriter does not do IO.
-<span class="nc" id="L527">            throw new IllegalStateException(e);</span>
+<span class="nc" id="L614">            throw new IllegalStateException(e);</span>
         }
     }
 
     /**
+     * Specifies whether missing column names are allowed when parsing the header line.
+     *
+     * @return {@code true} if missing column names are allowed when parsing the header line, {@code false} to throw an
+     *         {@link IllegalArgumentException}.
+     */
+    public boolean getAllowMissingColumnNames() {
+<span class="fc" id="L625">        return allowMissingColumnNames;</span>
+    }
+
+    /**
      * Returns the character marking the start of a line comment.
      *
      * @return the comment start marker, may be {@code null}
      */
     public Character getCommentMarker() {
-<span class="fc" id="L537">        return commentMarker;</span>
+<span class="fc" id="L634">        return commentMarker;</span>
     }
 
     /**
@@ -543,7 +640,7 @@ public final class CSVFormat implements
      * @return the delimiter character
      */
     public char getDelimiter() {
-<span class="fc" id="L546">        return delimiter;</span>
+<span class="fc" id="L643">        return delimiter;</span>
     }
 
     /**
@@ -552,7 +649,7 @@ public final class CSVFormat implements
      * @return the escape character, may be {@code null}
      */
     public Character getEscapeCharacter() {
-<span class="fc" id="L555">        return escapeCharacter;</span>
+<span class="fc" id="L652">        return escapeCharacter;</span>
     }
 
     /**
@@ -561,7 +658,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="L564" title="All 2 branches covered.">        return header != null ? header.clone() : null;</span>
+<span class="fc bfc" id="L661" title="All 2 branches covered.">        return header != null ? header.clone() : null;</span>
     }
 
     /**
@@ -570,27 +667,27 @@ 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="L573" title="All 2 branches covered.">        return headerComments != null ? headerComments.clone() : null;</span>
+<span class="fc bfc" id="L670" title="All 2 branches covered.">        return headerComments != null ? headerComments.clone() : null;</span>
     }
 
     /**
-     * Specifies whether missing column names are allowed when parsing the header line.
+     * Specifies whether empty lines between records are ignored when parsing input.
      *
-     * @return {@code true} if missing column names are allowed when parsing the header line, {@code false} to throw an
-     *         {@link IllegalArgumentException}.
+     * @return {@code true} if empty lines between records are ignored, {@code false} if they are turned into empty
+     *         records.
      */
-    public boolean getAllowMissingColumnNames() {
-<span class="fc" id="L583">        return allowMissingColumnNames;</span>
+    public boolean getIgnoreEmptyLines() {
+<span class="fc" id="L680">        return ignoreEmptyLines;</span>
     }
 
     /**
-     * Specifies whether empty lines between records are ignored when parsing input.
+     * Specifies whether header names will be accessed ignoring case.
      *
-     * @return {@code true} if empty lines between records are ignored, {@code false} if they are turned into empty
-     *         records.
+     * @return {@code true} if header names cases are ignored, {@code false} if they are case sensitive.
+     * @since 1.3
      */
-    public boolean getIgnoreEmptyLines() {
-<span class="fc" id="L593">        return ignoreEmptyLines;</span>
+    public boolean getIgnoreHeaderCase() {
+<span class="fc" id="L690">        return ignoreHeaderCase;</span>
     }
 
     /**
@@ -599,23 +696,21 @@ 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="L602">        return ignoreSurroundingSpaces;</span>
+<span class="fc" id="L699">        return ignoreSurroundingSpaces;</span>
     }
 
     /**
      * Gets the String to convert to and from {@code null}.
      * &lt;ul&gt;
-     * &lt;li&gt;
-     * &lt;strong&gt;Reading:&lt;/strong&gt; Converts strings equal to the given {@code nullString} to {@code null} when reading
+     * &lt;li&gt;&lt;strong&gt;Reading:&lt;/strong&gt; Converts strings equal to the given {@code nullString} to {@code null} when reading
      * records.&lt;/li&gt;
-     * &lt;li&gt;
-     * &lt;strong&gt;Writing:&lt;/strong&gt; Writes {@code null} as the given {@code nullString} when writing records.&lt;/li&gt;
+     * &lt;li&gt;&lt;strong&gt;Writing:&lt;/strong&gt; Writes {@code null} as the given {@code nullString} when writing records.&lt;/li&gt;
      * &lt;/ul&gt;
      *
      * @return the String to convert to and from {@code null}. No substitution occurs if {@code null}
      */
     public String getNullString() {
-<span class="fc" id="L618">        return nullString;</span>
+<span class="fc" id="L713">        return nullString;</span>
     }
 
     /**
@@ -624,7 +719,7 @@ public final class CSVFormat implements
      * @return the quoteChar character, may be {@code null}
      */
     public Character getQuoteCharacter() {
-<span class="fc" id="L627">        return quoteCharacter;</span>
+<span class="fc" id="L722">        return quoteCharacter;</span>
     }
 
     /**
@@ -633,7 +728,7 @@ public final class CSVFormat implements
      * @return the quote policy
      */
     public QuoteMode getQuoteMode() {
-<span class="fc" id="L636">        return quoteMode;</span>
+<span class="fc" id="L731">        return quoteMode;</span>
     }
 
     /**
@@ -642,7 +737,7 @@ public final class CSVFormat implements
      * @return the record separator
      */
     public String getRecordSeparator() {
-<span class="fc" id="L645">        return recordSeparator;</span>
+<span class="fc" id="L740">        return recordSeparator;</span>
     }
 
     /**
@@ -651,26 +746,46 @@ public final class CSVFormat implements
      * @return whether to skip the header record.
      */
     public boolean getSkipHeaderRecord() {
-<span class="fc" id="L654">        return skipHeaderRecord;</span>
+<span class="fc" id="L749">        return skipHeaderRecord;</span>
+    }
+
+    /**
+     * Returns whether to add a trailing delimiter.
+     *
+     * @return whether to add a trailing delimiter.
+     * @since 1.3
+     */
+    public boolean getTrailingDelimiter() {
+<span class="fc" id="L759">        return trailingDelimiter;</span>
+    }
+
+    /**
+     * Returns whether to trim leading and trailing blanks.
+     *
+     * @return whether to trim leading and trailing blanks.
+     */
+    public boolean getTrim() {
+<span class="fc" id="L768">        return trim;</span>
     }
 
     @Override
     public int hashCode() {
-<span class="fc" id="L659">        final int prime = 31;</span>
-<span class="fc" id="L660">        int result = 1;</span>
+<span class="fc" id="L773">        final int prime = 31;</span>
+<span class="fc" id="L774">        int result = 1;</span>
 
-<span class="fc" id="L662">        result = prime * result + delimiter;</span>
-<span class="pc bpc" id="L663" title="1 of 2 branches missed.">        result = prime * result + ((quoteMode == null) ? 0 : quoteMode.hashCode());</span>
-<span class="pc bpc" id="L664" title="1 of 2 branches missed.">        result = prime * result + ((quoteCharacter == null) ? 0 : quoteCharacter.hashCode());</span>
-<span class="pc bpc" id="L665" title="1 of 2 branches missed.">        result = prime * result + ((commentMarker == null) ? 0 : commentMarker.hashCode());</span>
-<span class="pc bpc" id="L666" title="1 of 2 branches missed.">        result = prime * result + ((escapeCharacter == null) ? 0 : escapeCharacter.hashCode());</span>
-<span class="pc bpc" id="L667" title="1 of 2 branches missed.">        result = prime * result + ((nullString == null) ? 0 : nullString.hashCode());</span>
-<span class="pc bpc" id="L668" title="1 of 2 branches missed.">        result = prime * result + (ignoreSurroundingSpaces ? 1231 : 1237);</span>
-<span class="pc bpc" id="L669" title="1 of 2 branches missed.">        result = prime * result + (ignoreEmptyLines ? 1231 : 1237);</span>
-<span class="pc bpc" id="L670" title="1 of 2 branches missed.">        result = prime * result + (skipHeaderRecord ? 1231 : 1237);</span>
-<span class="pc bpc" id="L671" title="1 of 2 branches missed.">        result = prime * result + ((recordSeparator == null) ? 0 : recordSeparator.hashCode());</span>
-<span class="fc" id="L672">        result = prime * result + Arrays.hashCode(header);</span>
-<span class="fc" id="L673">        return result;</span>
+<span class="fc" id="L776">        result = prime * result + delimiter;</span>
+<span class="pc bpc" id="L777" title="1 of 2 branches missed.">        result = prime * result + ((quoteMode == null) ? 0 : quoteMode.hashCode());</span>
+<span class="pc bpc" id="L778" title="1 of 2 branches missed.">        result = prime * result + ((quoteCharacter == null) ? 0 : quoteCharacter.hashCode());</span>
+<span class="pc bpc" id="L779" title="1 of 2 branches missed.">        result = prime * result + ((commentMarker == null) ? 0 : commentMarker.hashCode());</span>
+<span class="pc bpc" id="L780" title="1 of 2 branches missed.">        result = prime * result + ((escapeCharacter == null) ? 0 : escapeCharacter.hashCode());</span>
+<span class="pc bpc" id="L781" title="1 of 2 branches missed.">        result = prime * result + ((nullString == null) ? 0 : nullString.hashCode());</span>
+<span class="pc bpc" id="L782" title="1 of 2 branches missed.">        result = prime * result + (ignoreSurroundingSpaces ? 1231 : 1237);</span>
+<span class="pc bpc" id="L783" title="1 of 2 branches missed.">        result = prime * result + (ignoreHeaderCase ? 1231 : 1237);</span>
+<span class="pc bpc" id="L784" title="1 of 2 branches missed.">        result = prime * result + (ignoreEmptyLines ? 1231 : 1237);</span>
+<span class="pc bpc" id="L785" title="1 of 2 branches missed.">        result = prime * result + (skipHeaderRecord ? 1231 : 1237);</span>
+<span class="pc bpc" id="L786" title="1 of 2 branches missed.">        result = prime * result + ((recordSeparator == null) ? 0 : recordSeparator.hashCode());</span>
+<span class="fc" id="L787">        result = prime * result + Arrays.hashCode(header);</span>
+<span class="fc" id="L788">        return result;</span>
     }
 
     /**
@@ -681,7 +796,7 @@ public final class CSVFormat implements
      * @return {@code true} is comments are supported, {@code false} otherwise
      */
     public boolean isCommentMarkerSet() {
-<span class="fc bfc" id="L684" title="All 2 branches covered.">        return commentMarker != null;</span>
+<span class="fc bfc" id="L799" title="All 2 branches covered.">        return commentMarker != null;</span>
     }
 
     /**
@@ -690,7 +805,7 @@ public final class CSVFormat implements
      * @return {@code true} if escapes are processed
      */
     public boolean isEscapeCharacterSet() {
-<span class="fc bfc" id="L693" title="All 2 branches covered.">        return escapeCharacter != null;</span>
+<span class="fc bfc" id="L808" title="All 2 branches covered.">        return escapeCharacter != null;</span>
     }
 
     /**
@@ -699,7 +814,7 @@ public final class CSVFormat implements
      * @return {@code true} if a nullString is defined
      */
     public boolean isNullStringSet() {
-<span class="pc bpc" id="L702" title="1 of 2 branches missed.">        return nullString != null;</span>
+<span class="pc bpc" id="L817" title="1 of 2 branches missed.">        return nullString != null;</span>
     }
 
     /**
@@ -708,7 +823,7 @@ public final class CSVFormat implements
      * @return {@code true} if a quoteChar is defined
      */
     public boolean isQuoteCharacterSet() {
-<span class="fc bfc" id="L711" title="All 2 branches covered.">        return quoteCharacter != null;</span>
+<span class="fc bfc" id="L826" title="All 2 branches covered.">        return quoteCharacter != null;</span>
     }
 
     /**
@@ -725,7 +840,7 @@ public final class CSVFormat implements
      *             If an I/O error occurs
      */
     public CSVParser parse(final Reader in) throws IOException {
-<span class="fc" id="L728">        return new CSVParser(in, this);</span>
+<span class="fc" id="L843">        return new CSVParser(in, this);</span>
     }
 
     /**
@@ -742,49 +857,64 @@ 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="L745">        return new CSVPrinter(out, this);</span>
+<span class="fc" id="L860">        return new CSVPrinter(out, this);</span>
     }
 
     @Override
     public String toString() {
-<span class="fc" id="L750">        final StringBuilder sb = new StringBuilder();</span>
-<span class="fc" id="L751">        sb.append(&quot;Delimiter=&lt;&quot;).append(delimiter).append('&gt;');</span>
-<span class="pc bpc" id="L752" title="1 of 2 branches missed.">        if (isEscapeCharacterSet()) {</span>
-<span class="nc" id="L753">            sb.append(' ');</span>
-<span class="nc" id="L754">            sb.append(&quot;Escape=&lt;&quot;).append(escapeCharacter).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L756" title="1 of 2 branches missed.">        if (isQuoteCharacterSet()) {</span>
-<span class="fc" id="L757">            sb.append(' ');</span>
-<span class="fc" id="L758">            sb.append(&quot;QuoteChar=&lt;&quot;).append(quoteCharacter).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L760" title="All 2 branches covered.">        if (isCommentMarkerSet()) {</span>
-<span class="fc" id="L761">            sb.append(' ');</span>
-<span class="fc" id="L762">            sb.append(&quot;CommentStart=&lt;&quot;).append(commentMarker).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L764" title="1 of 2 branches missed.">        if (isNullStringSet()) {</span>
-<span class="nc" id="L765">            sb.append(' ');</span>
-<span class="nc" id="L766">            sb.append(&quot;NullString=&lt;&quot;).append(nullString).append('&gt;');</span>
-        }
-<span class="pc bpc" id="L768" title="1 of 2 branches missed.">        if (recordSeparator != null) {</span>
-<span class="nc" id="L769">            sb.append(' ');</span>
-<span class="nc" id="L770">            sb.append(&quot;RecordSeparator=&lt;&quot;).append(recordSeparator).append('&gt;');</span>
-        }
-<span class="fc bfc" id="L772" title="All 2 branches covered.">        if (getIgnoreEmptyLines()) {</span>
-<span class="fc" id="L773">            sb.append(&quot; EmptyLines:ignored&quot;);</span>
-        }
-<span class="fc bfc" id="L775" title="All 2 branches covered.">        if (getIgnoreSurroundingSpaces()) {</span>
-<span class="fc" id="L776">            sb.append(&quot; SurroundingSpaces:ignored&quot;);</span>
-        }
-<span class="fc" id="L778">        sb.append(&quot; SkipHeaderRecord:&quot;).append(skipHeaderRecord);</span>
-<span class="pc bpc" id="L779" title="1 of 2 branches missed.">        if (headerComments != null) {</span>
-<span class="nc" id="L780">            sb.append(' ');</span>
-<span class="nc" id="L781">            sb.append(&quot;HeaderComments:&quot;).append(Arrays.toString(headerComments));</span>
-        }
-<span class="pc bpc" id="L783" title="1 of 2 branches missed.">        if (header != null) {</span>
-<span class="nc" id="L784">            sb.append(' ');</span>
-<span class="nc" id="L785">            sb.append(&quot;Header:&quot;).append(Arrays.toString(header));</span>
+<span class="fc" id="L865">        final StringBuilder sb = new StringBuilder();</span>
+<span class="fc" id="L866">        sb.append(&quot;Delimiter=&lt;&quot;).append(delimiter).append('&gt;');</span>
+<span class="pc bpc" id="L867" title="1 of 2 branches missed.">        if (isEscapeCharacterSet()) {</span>
+<span class="nc" id="L868">            sb.append(' ');</span>
+<span class="nc" id="L869">            sb.append(&quot;Escape=&lt;&quot;).append(escapeCharacter).append('&gt;');</span>
+        }
+<span class="pc bpc" id="L871" title="1 of 2 branches missed.">        if (isQuoteCharacterSet()) {</span>
+<span class="fc" id="L872">            sb.append(' ');</span>
+<span class="fc" id="L873">            sb.append(&quot;QuoteChar=&lt;&quot;).append(quoteCharacter).append('&gt;');</span>
+        }
+<span class="fc bfc" id="L875" title="All 2 branches covered.">        if (isCommentMarkerSet()) {</span>
+<span class="fc" id="L876">            sb.append(' ');</span>
+<span class="fc" id="L877">            sb.append(&quot;CommentStart=&lt;&quot;).append(commentMarker).append('&gt;');</span>
+        }
+<span class="pc bpc" id="L879" title="1 of 2 branches missed.">        if (isNullStringSet()) {</span>
+<span class="nc" id="L880">            sb.append(' ');</span>
+<span class="nc" id="L881">            sb.append(&quot;NullString=&lt;&quot;).append(nullString).append('&gt;');</span>
+        }
+<span class="pc bpc" id="L883" title="1 of 2 branches missed.">        if (recordSeparator != null) {</span>
+<span class="nc" id="L884">            sb.append(' ');</span>
+<span class="nc" id="L885">            sb.append(&quot;RecordSeparator=&lt;&quot;).append(recordSeparator).append('&gt;');</span>
+        }
+<span class="fc bfc" id="L887" title="All 2 branches covered.">        if (getIgnoreEmptyLines()) {</span>
+<span class="fc" id="L888">            sb.append(&quot; EmptyLines:ignored&quot;);</span>
+        }
+<span class="fc bfc" id="L890" title="All 2 branches covered.">        if (getIgnoreSurroundingSpaces()) {</span>
+<span class="fc" id="L891">            sb.append(&quot; SurroundingSpaces:ignored&quot;);</span>
+        }
+<span class="pc bpc" id="L893" title="1 of 2 branches missed.">        if (getIgnoreHeaderCase()) {</span>
+<span class="nc" id="L894">            sb.append(&quot; IgnoreHeaderCase:ignored&quot;);</span>
+        }
+<span class="fc" id="L896">        sb.append(&quot; SkipHeaderRecord:&quot;).append(skipHeaderRecord);</span>
+<span class="pc bpc" id="L897" title="1 of 2 branches missed.">        if (headerComments != null) {</span>
+<span class="nc" id="L898">            sb.append(' ');</span>
+<span class="nc" id="L899">            sb.append(&quot;HeaderComments:&quot;).append(Arrays.toString(headerComments));</span>
+        }
+<span class="pc bpc" id="L901" title="1 of 2 branches missed.">        if (header != null) {</span>
+<span class="nc" id="L902">            sb.append(' ');</span>
+<span class="nc" id="L903">            sb.append(&quot;Header:&quot;).append(Arrays.toString(header));</span>
+        }
+<span class="fc" id="L905">        return sb.toString();</span>
+    }
+
+    private String[] toStringArray(final Object[] values) {
+<span class="fc bfc" id="L909" title="All 2 branches covered.">        if (values == null) {</span>
+<span class="fc" id="L910">            return null;</span>
         }
-<span class="fc" id="L787">        return sb.toString();</span>
+<span class="fc" id="L912">        final String[] strings = new String[values.length];</span>
+<span class="fc bfc" id="L913" title="All 2 branches covered.">        for (int i = 0; i &lt; values.length; i++) {</span>
+<span class="fc" id="L914">            final Object value = values[i];</span>
+<span class="pc bpc" id="L915" title="1 of 2 branches missed.">            strings[i] = value == null ? null : value.toString();</span>
+        }
+<span class="fc" id="L917">        return strings;</span>
     }
 
     /**
@@ -793,53 +923,78 @@ public final class CSVFormat implements
      * @throws IllegalArgumentException
      */
     private void validate() throws IllegalArgumentException {
-<span class="pc bpc" id="L796" title="1 of 2 branches missed.">        if (isLineBreak(delimiter)) {</span>
-<span class="nc" id="L797">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
+<span class="pc bpc" id="L926" title="1 of 2 branches missed.">        if (isLineBreak(delimiter)) {</span>
+<span class="nc" id="L927">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
         }
-        
-<span class="fc bfc" id="L800" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; delimiter == quoteCharacter.charValue()) {</span>
-<span class="fc" id="L801">            throw new IllegalArgumentException(&quot;The quoteChar character and the delimiter cannot be the same ('&quot; +</span>
-                    quoteCharacter + &quot;')&quot;);
+
+<span class="fc bfc" id="L930" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; delimiter == quoteCharacter.charValue()) {</span>
+<span class="fc" id="L931">            throw new IllegalArgumentException(</span>
+                    &quot;The quoteChar character and the delimiter cannot be the same ('&quot; + quoteCharacter + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L805" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; delimiter == escapeCharacter.charValue()) {</span>
-<span class="fc" id="L806">            throw new IllegalArgumentException(&quot;The escape character and the delimiter cannot be the same ('&quot; +</span>
-                    escapeCharacter + &quot;')&quot;);
+<span class="fc bfc" id="L935" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; delimiter == escapeCharacter.charValue()) {</span>
+<span class="fc" id="L936">            throw new IllegalArgumentException(</span>
+                    &quot;The escape character and the delimiter cannot be the same ('&quot; + escapeCharacter + &quot;')&quot;);
         }
 
-<span class="fc bfc" id="L810" title="All 4 branches covered.">        if (commentMarker != null &amp;&amp; delimiter == commentMarker.charValue()) {</span>
-<span class="fc" id="L811">            throw new IllegalArgumentException(&quot;The comment start character and the delimiter cannot be the same ('&quot; +</span>
-                    commentMarker + &quot;')&quot;);
+<span class="fc bfc" id="L940" title="All 4 branches covered.">        if (commentMarker != null &amp;&amp; delimiter == commentMarker.charValue()) {</span>
+<span class="fc" id="L941">            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="L815" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; quoteCharacter.equals(commentMarker)) {</span>
-<span class="fc" id="L816">            throw new IllegalArgumentException(&quot;The comment start character and the quoteChar cannot be the same ('&quot; +</span>
-                    commentMarker + &quot;')&quot;);
+<span class="fc bfc" id="L945" title="All 4 branches covered.">        if (quoteCharacter != null &amp;&amp; quoteCharacter.equals(commentMarker)) {</span>
+<span class="fc" id="L946">            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="L820" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; escapeCharacter.equals(commentMarker)) {</span>
-<span class="fc" id="L821">            throw new IllegalArgumentException(&quot;The comment start and the escape character cannot be the same ('&quot; +</span>
-                    commentMarker + &quot;')&quot;);
+<span class="fc bfc" id="L950" title="All 4 branches covered.">        if (escapeCharacter != null &amp;&amp; escapeCharacter.equals(commentMarker)) {</span>
+<span class="fc" id="L951">            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="L825" title="All 4 branches covered.">        if (escapeCharacter == null &amp;&amp; quoteMode == QuoteMode.NONE) {</span>
-<span class="fc" id="L826">            throw new IllegalArgumentException(&quot;No quotes mode set but no escape character is set&quot;);</span>
+<span class="fc bfc" id="L955" title="All 4 branches covered.">        if (escapeCharacter == null &amp;&amp; quoteMode == QuoteMode.NONE) {</span>
+<span class="fc" id="L956">            throw new IllegalArgumentException(&quot;No quotes mode set but no escape character is set&quot;);</span>
         }
-        
+
         // validate header
-<span class="fc bfc" id="L830" title="All 2 branches covered.">        if (header != null) {</span>
-<span class="fc" id="L831">            final Set&lt;String&gt; dupCheck = new HashSet&lt;String&gt;();</span>
-<span class="fc bfc" id="L832" title="All 2 branches covered.">            for (final String hdr : header) {</span>
-<span class="fc bfc" id="L833" title="All 2 branches covered.">                if (!dupCheck.add(hdr)) {</span>
-<span class="fc" id="L834">                    throw new IllegalArgumentException(&quot;The header contains a duplicate entry: '&quot; + hdr + &quot;' in &quot; +</span>
-<span class="fc" id="L835">                            Arrays.toString(header));</span>
+<span class="fc bfc" id="L960" title="All 2 branches covered.">        if (header != null) {</span>
+<span class="fc" id="L961">            final Set&lt;String&gt; dupCheck = new HashSet&lt;String&gt;();</span>
+<span class="fc bfc" id="L962" title="All 2 branches covered.">            for (final String hdr : header) {</span>
+<span class="fc bfc" id="L963" title="All 2 branches covered.">                if (!dupCheck.add(hdr)) {</span>
+<span class="fc" id="L964">                    throw new IllegalArgumentException(</span>
+<span class="fc" id="L965">                            &quot;The header contains a duplicate entry: '&quot; + hdr + &quot;' in &quot; + Arrays.toString(header));</span>
                 }
             }
         }
-<span class="fc" id="L839">    }</span>
+<span class="fc" id="L969">    }</span>
+
+    /**
+     * Returns a new {@code CSVFormat} with the missing column names behavior of the format set to {@code true}
+     *
+     * @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
+     * @see #withAllowMissingColumnNames(boolean)
+     * @since 1.1
+     */
+    public CSVFormat withAllowMissingColumnNames() {
+<span class="fc" id="L979">        return this.withAllowMissingColumnNames(true);</span>
+    }
+
+    /**
+     * Returns a new {@code CSVFormat} with the missing column names behavior of the format set to the given value.
+     *
+     * @param allowMissingColumnNames
+     *            the missing column names behavior, {@code true} to allow missing column names in the header line,
+     *            {@code false} to cause an {@link IllegalArgumentException} to be thrown.
+     * @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="L991">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+                ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+    }
 
     /**
-     * Sets the comment start marker of the format to the specified character.
+     * Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
      *
      * Note that the comment start character is only recognized at the start of a line.
      *
@@ -850,11 +1005,11 @@ public final class CSVFormat implements
      *             thrown if the specified character is a line break
      */
     public CSVFormat withCommentMarker(final char commentMarker) {
-<span class="fc" id="L853">        return withCommentMarker(Character.valueOf(commentMarker));</span>
+<span class="fc" id="L1008">        return withCommentMarker(Character.valueOf(commentMarker));</span>
     }
 
     /**
-     * Sets the comment start marker of the format to the specified character.
+     * Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
      *
      * Note that the comment start character is only recognized at the start of a line.
      *
@@ -865,16 +1020,16 @@ 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="L868" title="All 2 branches covered.">        if (isLineBreak(commentMarker)) {</span>
-<span class="fc" id="L869">            throw new IllegalArgumentException(&quot;The comment start marker character cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1023" title="All 2 branches covered.">        if (isLineBreak(commentMarker)) {</span>
+<span class="fc" id="L1024">            throw new IllegalArgumentException(&quot;The comment start marker character cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L871">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1026">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Sets the delimiter of the format to the specified character.
+     * Returns a new {@code CSVFormat} with the delimiter of the format set to the specified character.
      *
      * @param delimiter
      *            the delimiter character
@@ -883,16 +1038,16 @@ 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="L886" title="All 2 branches covered.">        if (isLineBreak(delimiter)) {</span>
-<span class="fc" id="L887">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1041" title="All 2 branches covered.">        if (isLineBreak(delimiter)) {</span>
+<span class="fc" id="L1042">            throw new IllegalArgumentException(&quot;The delimiter cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L889">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1044">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Sets the escape character of the format to the specified character.
+     * Returns a new {@code CSVFormat} with the escape character of the format set to the specified character.
      *
      * @param escape
      *            the escape character
@@ -901,11 +1056,11 @@ public final class CSVFormat implements
      *             thrown if the specified character is a line break
      */
     public CSVFormat withEscape(final char escape) {
-<span class="fc" id="L904">        return withEscape(Character.valueOf(escape));</span>
+<span class="fc" id="L1059">        return withEscape(Character.valueOf(escape));</span>
     }
 
     /**
-     * Sets the escape character of the format to the specified character.
+     * Returns a new {@code CSVFormat} with the escape character of the format set to the specified character.
      *
      * @param escape
      *            the escape character, use {@code null} to disable
@@ -914,44 +1069,36 @@ 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="L917" title="All 2 branches covered.">        if (isLineBreak(escape)) {</span>
-<span class="fc" id="L918">            throw new IllegalArgumentException(&quot;The escape character cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1072" title="All 2 branches covered.">        if (isLineBreak(escape)) {</span>
+<span class="fc" id="L1073">            throw new IllegalArgumentException(&quot;The escape character cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L920">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escape, ignoreSurroundingSpaces,</span>
+<span class="fc" id="L1075">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escape, ignoreSurroundingSpaces,</span>
                 ignoreEmptyLines, recordSeparator, nullString, headerComments, header, skipHeaderRecord,
-                allowMissingColumnNames);
+                allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Sets the header of the format. The header can either be parsed automatically from the input file with:
+     * Returns a new {@code CSVFormat} using the first record as header.
      *
-     * &lt;pre&gt;
-     * CSVFormat format = aformat.withHeader();
-     * &lt;/pre&gt;
-     *
-     * or specified manually with:
-     *
-     * &lt;pre&gt;
-     * CSVFormat format = aformat.withHeader(&amp;quot;name&amp;quot;, &amp;quot;email&amp;quot;, &amp;quot;phone&amp;quot;);
-     * &lt;/pre&gt;
      * &lt;p&gt;
-     * The header is also used by the {@link CSVPrinter}..
+     * Calling this method is equivalent to calling:
      * &lt;/p&gt;
+     * &lt;pre&gt;
+     * CSVFormat format = aFormat.withHeader().withSkipHeaderRecord();
+     * &lt;/pre&gt;
      *
-     * @param header
-     *            the header, {@code null} if disabled, empty if parsed automatically, user specified otherwise.
-     *
-     * @return A new CSVFormat that is equal to this but with the specified header
+     * @return A new CSVFormat that is equal to this but using the first record as header.
      * @see #withSkipHeaderRecord(boolean)
+     * @see #withHeader(String...)
+     * @since 1.3
      */
-    public CSVFormat withHeader(final String... header) {
-<span class="fc" id="L948">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
-                ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+    public CSVFormat withFirstRecordAsHeader() {
+<span class="fc" id="L1096">        return withHeader().withSkipHeaderRecord();</span>
     }
 
     /**
-     * Sets the header of the format. The header can either be parsed automatically from the input file with:
+     * Returns a new {@code CSVFormat} with the header of the format set from the result set metadata. The header can
+     * either be parsed automatically from the input file with:
      *
      * &lt;pre&gt;
      * CSVFormat format = aformat.withHeader();
@@ -976,11 +1123,12 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withHeader(final ResultSet resultSet) throws SQLException {
-<span class="pc bpc" id="L979" title="1 of 2 branches missed.">        return withHeader(resultSet != null ? resultSet.getMetaData() : null);</span>
+<span class="pc bpc" id="L1126" title="1 of 2 branches missed.">        return withHeader(resultSet != null ? resultSet.getMetaData() : null);</span>
     }
 
     /**
-     * Sets the header of the format. The header can either be parsed automatically from the input file with:
+     * Returns a new {@code CSVFormat} with the header of the format set from the result set metadata. The header can
+     * either be parsed automatically from the input file with:
      *
      * &lt;pre&gt;
      * CSVFormat format = aformat.withHeader();
@@ -1005,78 +1153,115 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withHeader(final ResultSetMetaData metaData) throws SQLException {
-<span class="fc" id="L1008">        String[] labels = null;</span>
-<span class="pc bpc" id="L1009" title="1 of 2 branches missed.">        if (metaData != null) {</span>
-<span class="fc" id="L1010">            final int columnCount = metaData.getColumnCount();</span>
-<span class="fc" id="L1011">            labels = new String[columnCount];</span>
-<span class="fc bfc" id="L1012" title="All 2 branches covered.">            for (int i = 0; i &lt; columnCount; i++) {</span>
-<span class="fc" id="L1013">                labels[i] = metaData.getColumnLabel(i + 1);</span>
+<span class="fc" id="L1156">        String[] labels = null;</span>
+<span class="pc bpc" id="L1157" title="1 of 2 branches missed.">        if (metaData != null) {</span>
+<span class="fc" id="L1158">            final int columnCount = metaData.getColumnCount();</span>
+<span class="fc" id="L1159">            labels = new String[columnCount];</span>
+<span class="fc bfc" id="L1160" title="All 2 branches covered.">            for (int i = 0; i &lt; columnCount; i++) {</span>
+<span class="fc" id="L1161">                labels[i] = metaData.getColumnLabel(i + 1);</span>
             }
         }
-<span class="fc" id="L1016">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
-                ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, labels,
-                skipHeaderRecord, allowMissingColumnNames);
+<span class="fc" id="L1164">        return withHeader(labels);</span>
     }
 
     /**
-     * Sets the header comments of the format. The comments will be printed first, before the headers. This setting is
-     * ignored by the parser.
+     * Returns a new {@code CSVFormat} with the header of the format set to the given values. The header can either be
+     * parsed automatically from the input file with:
      *
      * &lt;pre&gt;
-     * CSVFormat format = aformat.withHeaderComments(&amp;quot;Generated by Apache Commons CSV 1.1.&amp;quot;, new Date());
+     * CSVFormat format = aformat.withHeader();
      * &lt;/pre&gt;
      *
-     * @param headerComments
-     *            the headerComments which will be printed by the Printer before the actual CSV data.
+     * or specified manually with:
+     *
+     * &lt;pre&gt;
+     * CSVFormat format = aformat.withHeader(&amp;quot;name&amp;quot;, &amp;quot;email&amp;quot;, &amp;quot;phone&amp;quot;);
+     * &lt;/pre&gt;
+     * &lt;p&gt;
+     * The header is also used by the {@link CSVPrinter}..
+     * &lt;/p&gt;
+     *
+     * @param header
+     *            the header, {@code null} if disabled, empty if parsed automatically, user specified otherwise.
      *
      * @return A new CSVFormat that is equal to this but with the specified header
      * @see #withSkipHeaderRecord(boolean)
-     * @since 1.1
      */
-    public CSVFormat withHeaderComments(final Object... headerComments) {
-<span class="fc" id="L1037">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+    public CSVFormat withHeader(final String... header) {
+<span class="fc" id="L1191">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Sets the missing column names behavior of the format to {@code true}
+     * Returns a new {@code CSVFormat} with the header of the format defined by the enum class:
      *
-     * @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
-     * @see #withAllowMissingColumnNames(boolean)
-     * @since 1.1
+     * &lt;pre&gt;
+     * public enum Header {
+     *     Name, Email, Phone
+     * }
+     *
+     * CSVFormat format = aformat.withHeader(Header.class);
+     * &lt;/pre&gt;
+     * &lt;p&gt;
+     * The header is also used by the {@link CSVPrinter}..
+     * &lt;/p&gt;
+     *
+     * @param headerEnum
+     *              the enum defining the header, {@code null} if disabled, empty if parsed automatically, user
+     *              specified otherwise.
+     *
+     * @return A new CSVFormat that is equal to this but with the specified header
+     * @see #withHeader(String...)
+     * @see #withSkipHeaderRecord(boolean)
+     * @since 1.3
      */
-    public CSVFormat withAllowMissingColumnNames() {
-<span class="fc" id="L1050">        return this.withAllowMissingColumnNames(true);</span>
+    public CSVFormat withHeader(final Class&lt;? extends Enum&lt;?&gt;&gt; headerEnum) {
+<span class="fc" id="L1220">        String[] header = null;</span>
+<span class="pc bpc" id="L1221" title="1 of 2 branches missed.">        if (headerEnum != null) {</span>
+<span class="fc" id="L1222">            Enum&lt;?&gt;[] enumValues = headerEnum.getEnumConstants();</span>
+<span class="fc" id="L1223">            header = new String[enumValues.length];</span>
+<span class="fc bfc" id="L1224" title="All 2 branches covered.">            for (int i = 0; i &lt; enumValues.length; i++) {</span>
+<span class="fc" id="L1225">                header[i] = enumValues[i].name();</span>
+            }
+        }
+<span class="fc" id="L1228">        return withHeader(header);</span>
     }
 
     /**
-     * Sets the missing column names behavior of the format.
+     * Returns a new {@code CSVFormat} with the header comments of the format set to the given values. The comments will
+     * be printed first, before the headers. This setting is ignored by the parser.
      *
-     * @param allowMissingColumnNames
-     *            the missing column names behavior, {@code true} to allow missing column names in the header line,
-     *            {@code false} to cause an {@link IllegalArgumentException} to be thrown.
-     * @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
+     * &lt;pre&gt;
+     * CSVFormat format = aformat.withHeaderComments(&amp;quot;Generated by Apache Commons CSV 1.1.&amp;quot;, new Date());
+     * &lt;/pre&gt;
+     *
+     * @param headerComments
+     *            the headerComments which will be printed by the Printer before the actual CSV data.
+     *
+     * @return A new CSVFormat that is equal to this but with the specified header
+     * @see #withSkipHeaderRecord(boolean)
+     * @since 1.1
      */
-    public CSVFormat withAllowMissingColumnNames(final boolean allowMissingColumnNames) {
-<span class="fc" id="L1062">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+    public CSVFormat withHeaderComments(final Object... headerComments) {
+<span class="fc" id="L1247">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Sets the empty line skipping behavior of the format to {@code true}.
+     * Returns a new {@code CSVFormat} with the empty line skipping behavior of the format set to {@code true}.
      *
      * @return A new CSVFormat that is equal to this but with the specified empty line skipping behavior.
      * @since {@link #withIgnoreEmptyLines(boolean)}
      * @since 1.1
      */
     public CSVFormat withIgnoreEmptyLines() {
-<span class="fc" id="L1075">        return this.withIgnoreEmptyLines(true);</span>
+<span class="fc" id="L1260">        return this.withIgnoreEmptyLines(true);</span>
     }
 
     /**
-     * Sets the empty line skipping behavior of the format.
+     * Returns a new {@code CSVFormat} with the empty line skipping behavior of the format set to the given value.
      *
      * @param ignoreEmptyLines
      *            the empty line skipping behavior, {@code true} to ignore the empty lines between the records,
@@ -1084,24 +1269,50 @@ 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="L1087">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1272">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+    }
+
+    /**
+     * Returns a new {@code CSVFormat} with the header ignore case behavior set to {@code true}.
+     *
+     * @return A new CSVFormat that will ignore case header name.
+     * @see #withIgnoreHeaderCase(boolean)
+     * @since 1.3
+     */
+    public CSVFormat withIgnoreHeaderCase() {
+<span class="fc" id="L1285">        return this.withIgnoreHeaderCase(true);</span>
     }
 
     /**
-     * Sets the trimming behavior of the format to {@code true}.
+     * Returns a new {@code CSVFormat} with whether header names should be accessed ignoring case.
+     *
+     * @param ignoreHeaderCase
+     *            the case mapping behavior, {@code true} to access name/values, {@code false} to leave the mapping as
+     *            is.
+     * @return A new CSVFormat that will ignore case header name if specified as {@code true}
+     * @since 1.3
+     */
+    public CSVFormat withIgnoreHeaderCase(final boolean ignoreHeaderCase) {
+<span class="fc" id="L1298">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+                ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+    }
+
+    /**
+     * Returns a new {@code CSVFormat} with the trimming behavior of the format set to {@code true}.
      *
      * @return A new CSVFormat that is equal to this but with the specified trimming behavior.
      * @see #withIgnoreSurroundingSpaces(boolean)
      * @since 1.1
      */
     public CSVFormat withIgnoreSurroundingSpaces() {
-<span class="fc" id="L1100">        return this.withIgnoreSurroundingSpaces(true);</span>
+<span class="fc" id="L1311">        return this.withIgnoreSurroundingSpaces(true);</span>
     }
 
     /**
-     * Sets the trimming behavior of the format.
+     * Returns a new {@code CSVFormat} with the trimming behavior of the format set to the given value.
      *
      * @param ignoreSurroundingSpaces
      *            the trimming behavior, {@code true} to remove the surrounding spaces, {@code false} to leave the
@@ -1109,19 +1320,17 @@ public final class CSVFormat implements
      * @return A new CSVFormat that is equal to this but with the specified trimming behavior.
      */
     public CSVFormat withIgnoreSurroundingSpaces(final boolean ignoreSurroundingSpaces) {
-<span class="fc" id="L1112">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1323">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Performs conversions to and from null for strings on input and output.
+     * Returns a new {@code CSVFormat} with conversions to and from null for strings on input and output.
      * &lt;ul&gt;
-     * &lt;li&gt;
-     * &lt;strong&gt;Reading:&lt;/strong&gt; Converts strings equal to the given {@code nullString} to {@code null} when reading
+     * &lt;li&gt;&lt;strong&gt;Reading:&lt;/strong&gt; Converts strings equal to the given {@code nullString} to {@code null} when reading
      * records.&lt;/li&gt;
-     * &lt;li&gt;
-     * &lt;strong&gt;Writing:&lt;/strong&gt; Writes {@code null} as the given {@code nullString} when writing records.&lt;/li&gt;
+     * &lt;li&gt;&lt;strong&gt;Writing:&lt;/strong&gt; Writes {@code null} as the given {@code nullString} when writing records.&lt;/li&gt;
      * &lt;/ul&gt;
      *
      * @param nullString
@@ -1130,13 +1339,13 @@ public final class CSVFormat implements
      * @return A new CSVFormat that is equal to this but with the specified null conversion string.
      */
     public CSVFormat withNullString(final String nullString) {
-<span class="fc" id="L1133">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1342">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Sets the quoteChar of the format to the specified character.
+     * Returns a new {@code CSVFormat} with the quoteChar of the format set to the specified character.
      *
      * @param quoteChar
      *            the quoteChar character
@@ -1145,11 +1354,11 @@ public final class CSVFormat implements
      *             thrown if the specified character is a line break
      */
     public CSVFormat withQuote(final char quoteChar) {
-<span class="fc" id="L1148">        return withQuote(Character.valueOf(quoteChar));</span>
+<span class="fc" id="L1357">        return withQuote(Character.valueOf(quoteChar));</span>
     }
 
     /**
-     * Sets the quoteChar of the format to the specified character.
+     * Returns a new {@code CSVFormat} with the quoteChar of the format set to the specified character.
      *
      * @param quoteChar
      *            the quoteChar character, use {@code null} to disable
@@ -1158,16 +1367,16 @@ public final class CSVFormat implements
      *             thrown if the specified character is a line break
      */
     public CSVFormat withQuote(final Character quoteChar) {
-<span class="fc bfc" id="L1161" title="All 2 branches covered.">        if (isLineBreak(quoteChar)) {</span>
-<span class="fc" id="L1162">            throw new IllegalArgumentException(&quot;The quoteChar cannot be a line break&quot;);</span>
+<span class="fc bfc" id="L1370" title="All 2 branches covered.">        if (isLineBreak(quoteChar)) {</span>
+<span class="fc" id="L1371">            throw new IllegalArgumentException(&quot;The quoteChar cannot be a line break&quot;);</span>
         }
-<span class="fc" id="L1164">        return new CSVFormat(delimiter, quoteChar, quoteMode, commentMarker, escapeCharacter, ignoreSurroundingSpaces,</span>
+<span class="fc" id="L1373">        return new CSVFormat(delimiter, quoteChar, quoteMode, commentMarker, escapeCharacter, ignoreSurroundingSpaces,</span>
                 ignoreEmptyLines, recordSeparator, nullString, headerComments, header, skipHeaderRecord,
-                allowMissingColumnNames);
+                allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Sets the output quote policy of the format to the specified value.
+     * Returns a new {@code CSVFormat} with the output quote policy of the format set to the specified value.
      *
      * @param quoteModePolicy
      *            the quote policy to use for output.
@@ -1175,13 +1384,13 @@ public final class CSVFormat implements
      * @return A new CSVFormat that is equal to this but with the specified quote policy
      */
     public CSVFormat withQuoteMode(final QuoteMode quoteModePolicy) {
-<span class="fc" id="L1178">        return new CSVFormat(delimiter, quoteCharacter, quoteModePolicy, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1387">        return new CSVFormat(delimiter, quoteCharacter, quoteModePolicy, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Sets the record separator of the format to the specified character.
+     * Returns a new {@code CSVFormat} with the record separator of the format set to the specified character.
      *
      * &lt;p&gt;
      * &lt;strong&gt;Note:&lt;/strong&gt; This setting is only used during printing and does not affect parsing. Parsing currently
@@ -1194,11 +1403,11 @@ public final class CSVFormat implements
      * @return A new CSVFormat that is equal to this but with the the specified output record separator
      */
     public CSVFormat withRecordSeparator(final char recordSeparator) {
-<span class="fc" id="L1197">        return withRecordSeparator(String.valueOf(recordSeparator));</span>
+<span class="fc" id="L1406">        return withRecordSeparator(String.valueOf(recordSeparator));</span>
     }
 
     /**
-     * Sets the record separator of the format to the specified String.
+     * Returns a new {@code CSVFormat} with the record separator of the format set to the specified String.
      *
      * &lt;p&gt;
      * &lt;strong&gt;Note:&lt;/strong&gt; This setting is only used during printing and does not affect parsing. Parsing currently
@@ -1213,13 +1422,13 @@ public final class CSVFormat implements
      *             if recordSeparator is none of CR, LF or CRLF
      */
     public CSVFormat withRecordSeparator(final String recordSeparator) {
-<span class="fc" id="L1216">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1425">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 
     /**
-     * Sets skipping the header record to {@code true}.
+     * Returns a new {@code CSVFormat} with skipping the header record set to {@code true}.
      *
      * @return A new CSVFormat that is equal to this but with the the specified skipHeaderRecord setting.
      * @see #withSkipHeaderRecord(boolean)
@@ -1227,11 +1436,11 @@ public final class CSVFormat implements
      * @since 1.1
      */
     public CSVFormat withSkipHeaderRecord() {
-<span class="fc" id="L1230">        return this.withSkipHeaderRecord(true);</span>
+<span class="fc" id="L1439">        return this.withSkipHeaderRecord(true);</span>
     }
 
     /**
-     * Sets whether to skip the header record.
+     * Returns a new {@code CSVFormat} with whether to skip the header record.
      *
      * @param skipHeaderRecord
      *            whether to skip the header record.
@@ -1240,9 +1449,59 @@ public final class CSVFormat implements
      * @see #withHeader(String...)
      */
     public CSVFormat withSkipHeaderRecord(final boolean skipHeaderRecord) {
-<span class="fc" id="L1243">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+<span class="fc" id="L1452">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+                ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+    }
+
+    /**
+     * Returns a new {@code CSVFormat} to add a trailing delimiter.
+     *
+     * @return A new CSVFormat that is equal to this but with the trailing delimiter setting.
+     * @since 1.3
+     */
+    public CSVFormat withTrailingDelimiter() {
+<span class="fc" id="L1464">        return withTrailingDelimiter(true);</span>
+    }
+
+    /**
+     * Returns a new {@code CSVFormat} with whether to add a trailing delimiter.
+     *
+     * @param trailingDelimiter
+     *            whether to add a trailing delimiter.
+     *
+     * @return A new CSVFormat that is equal to this but with the specified trailing delimiter setting.
+     * @since 1.3
+     */
+    public CSVFormat withTrailingDelimiter(final boolean trailingDelimiter) {
+<span class="fc" id="L1477">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
+                ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
+    }
+
+    /**
+     * Returns a new {@code CSVFormat} to trim leading and trailing blanks.
+     *
+     * @return A new CSVFormat that is equal to this but with the trim setting on.
+     * @since 1.3
+     */
+    public CSVFormat withTrim() {
+<span class="fc" id="L1489">        return withTrim(true);</span>
+    }
+
+    /**
+     * Returns a new {@code CSVFormat} with whether to trim leading and trailing blanks.
+     *
+     * @param trim
+     *            whether to trim leading and trailing blanks.
+     *
+     * @return A new CSVFormat that is equal to this but with the specified trim setting.
+     * @since 1.3
+     */
+    public CSVFormat withTrim(final boolean trim) {
+<span class="fc" id="L1502">        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,</span>
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-                skipHeaderRecord, allowMissingColumnNames);
+                skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter);
     }
 }
-</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>
\ No newline at end of file

[... 3 lines stripped ...]



Mime
View raw message