You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/03/26 20:31:53 UTC

svn commit: r1305482 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java

Author: sebb
Date: Mon Mar 26 18:31:53 2012
New Revision: 1305482

URL: http://svn.apache.org/viewvc?rev=1305482&view=rev
Log:
CSV-77 RFC 4180 (DEFAULT) format is wrong; should not ignore spaces or blank lines

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1305482&r1=1305481&r2=1305482&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Mon Mar 26 18:31:53 2012
@@ -57,17 +57,38 @@ public class CSVFormat implements Serial
     private static CSVFormat PRISTINE = 
             new CSVFormat(DISABLED, DISABLED, DISABLED, DISABLED, false, false, false, null, null);
 
-    /** Standard comma separated format as defined by <a href="http://tools.ietf.org/html/rfc4180">RFC 4180</a>. */
+    /** 
+     * Standard comma separated format, as for {@link #RFC4180} but allowing blank lines. 
+     * <ul>
+     * <li>withDelimiter(',')</li>
+     * <li>withEncapsulator('"')</li>
+     * <li>withEmptyLinesIgnored(true)</li>
+     * <li>withLineSeparator(CRLF)</li>
+     * </ul> 
+     */
     public static final CSVFormat DEFAULT =
             PRISTINE.
             withDelimiter(',')
             .withEncapsulator('"')
-            .withLeadingSpacesIgnored(true)
-            .withTrailingSpacesIgnored(true)
             .withEmptyLinesIgnored(true)
             .withLineSeparator(CRLF)
             ;
 
+    /**
+     * Comma separated format as defined by <a href="http://tools.ietf.org/html/rfc4180">RFC 4180</a>.
+     * <ul>
+     * <li>withDelimiter(',')</li>
+     * <li>withEncapsulator('"')</li>
+     * <li>withLineSeparator(CRLF)</li>
+     * <li></li>
+     * </ul> 
+     */
+    public static final CSVFormat RFC4180 =
+            PRISTINE.
+            withDelimiter(',')
+            .withEncapsulator('"')
+            .withLineSeparator(CRLF)
+            ;
 
     /**
      * Excel file format (using a comma as the value delimiter).