Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8746811FCE for ; Mon, 14 Jul 2014 19:07:53 +0000 (UTC) Received: (qmail 8813 invoked by uid 500); 14 Jul 2014 19:07:53 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 8737 invoked by uid 500); 14 Jul 2014 19:07:53 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 8728 invoked by uid 99); 14 Jul 2014 19:07:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jul 2014 19:07:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jul 2014 19:07:53 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 812C82388906; Mon, 14 Jul 2014 19:07:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1610485 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Date: Mon, 14 Jul 2014 19:07:28 -0000 To: commits@commons.apache.org From: britter@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140714190728.812C82388906@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: britter Date: Mon Jul 14 19:07:28 2014 New Revision: 1610485 URL: http://svn.apache.org/r1610485 Log: Make JavaDoc more readable and clear up field values of CSVFormats 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=1610485&r1=1610484&r2=1610485&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 Jul 14 19:07:28 2014 @@ -161,28 +161,30 @@ public final class CSVFormat implements /** * Standard comma separated format, as for {@link #RFC4180} but allowing empty lines. - *

RFC 4180:

- *
    - *
  • withDelimiter(',')
  • - *
  • withQuoteChar('"')
  • - *
  • withRecordSeparator(CRLF)
  • - *
- *

Additional:

+ * + *

Settings are: *

    - *
  • withIgnoreEmptyLines(true)
  • + *
  • withDelimiter(',')
  • + *
  • withQuoteChar('"')
  • + *
  • withRecordSeparator("\r\n")
  • + *
  • withIgnoreEmptyLines(true)
  • *
+ *

*/ public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true, CRLF, null, null, false, false); /** * Comma separated format as defined by RFC 4180. - *

RFC 4180:

+ * + *

Settings are: *

    - *
  • withDelimiter(',')
  • - *
  • withQuoteChar('"')
  • - *
  • withRecordSeparator(CRLF)
  • + *
  • withDelimiter(',')
  • + *
  • withQuoteChar('"')
  • + *
  • withRecordSeparator("\r\n")
  • + *
  • withIgnoreEmptyLines(false)
  • *
+ *

*/ public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false); @@ -195,32 +197,59 @@ public final class CSVFormat implements *

* *
-     * CSVFormat fmt = CSVFormat.newBuilder(EXCEL).withDelimiter(';');
+     * CSVFormat fmt = CSVFormat.EXCEL.withDelimiter(';');
      * 
* *

* Settings are: - *

*
    - *
  • withDelimiter(',')
  • - *
  • withQuoteChar('"')
  • - *
  • withRecordSeparator(CRLF)
  • + *
  • withDelimiter(',')
  • + *
  • withQuoteChar('"')
  • + *
  • withRecordSeparator("\r\n")
  • + *
  • withIgnoreEmptyLines(false)
  • *
- * Note: this is currently the same as RFC4180 + *

+ *

+ * Note: this is currently the same as {@link #RFC4180}. + *

*/ public static final CSVFormat EXCEL = DEFAULT.withIgnoreEmptyLines(false); - /** Tab-delimited format, with quote; leading and trailing spaces ignored. */ + /** + * Tab-delimited format. + * + *

Settings are: + *

    + *
  • withDelimiter('\t')
  • + *
  • withQuoteChar('"')
  • + *
  • withRecordSeparator("\r\n")
  • + *
  • withIgnoreSurroundingSpaces(true)
  • + *
+ *

+ */ public static final CSVFormat TDF = DEFAULT .withDelimiter(TAB) .withIgnoreSurroundingSpaces(true); /** - * Default MySQL format used by the SELECT INTO OUTFILE and LOAD DATA INFILE operations. This is - * a tab-delimited format with a LF character as the line separator. Values are not quoted and special characters + * Default MySQL format used by the SELECT INTO OUTFILE and LOAD DATA INFILE operations. + * + *

+ * This is a tab-delimited format with a LF character as the line separator. Values are not quoted and special characters * are escaped with '\'. + *

* + *

+ * Settings are: + *

    + *
  • withDelimiter('\t')
  • + *
  • withQuoteChar(null)
  • + *
  • withRecordSeparator('\n')
  • + *
  • withIgnoreEmptyLines(false)
  • + *
  • withEscape('\\')
  • + *
+ *

* @see * http://dev.mysql.com/doc/refman/5.1/en/load-data.html */ @@ -259,10 +288,19 @@ public final class CSVFormat implements /** * Creates a new CSV format with the specified delimiter. * + *

Use this method if you want to create a CSVFormat from scratch. All fields but the delimiter will be + * initialized with null/false.

+ * * @param delimiter * the char used for value separation, must not be a line break character * @return a new CSV format. * @throws IllegalArgumentException if the delimiter is a line break character + * + * @see #DEFAULT + * @see #RFC4180 + * @see #MYSQL + * @see #EXCEL + * @see #TDF */ public static CSVFormat newFormat(final char delimiter) { return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, false, false);