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 0538011BA3 for ; Mon, 2 Jun 2014 18:05:12 +0000 (UTC) Received: (qmail 36668 invoked by uid 500); 2 Jun 2014 18:05:11 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 36595 invoked by uid 500); 2 Jun 2014 18:05:11 -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 36588 invoked by uid 99); 2 Jun 2014 18:05:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jun 2014 18:05:11 +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, 02 Jun 2014 18:05:10 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4A7152388980; Mon, 2 Jun 2014 18:04:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1599285 - in /commons/proper/csv/trunk/src: changes/changes.xml main/java/org/apache/commons/csv/CSVFormat.java test/java/org/apache/commons/csv/CSVPrinterTest.java Date: Mon, 02 Jun 2014 18:04:50 -0000 To: commits@commons.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140602180450.4A7152388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ggregory Date: Mon Jun 2 18:04:49 2014 New Revision: 1599285 URL: http://svn.apache.org/r1599285 Log: CSVFormat is missing a print(...) method Modified: commons/proper/csv/trunk/src/changes/changes.xml commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Modified: commons/proper/csv/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/changes/changes.xml?rev=1599285&r1=1599284&r2=1599285&view=diff ============================================================================== --- commons/proper/csv/trunk/src/changes/changes.xml (original) +++ commons/proper/csv/trunk/src/changes/changes.xml Mon Jun 2 18:04:49 2014 @@ -40,6 +40,7 @@ + CSVFormat is missing a print(...) method CSVRecord.toMap() throws NPE on formats with no headers. Check whether ISE/IAE are being used appropriately 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=1599285&r1=1599284&r2=1599285&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 Jun 2 18:04:49 2014 @@ -595,6 +595,21 @@ public final class CSVFormat implements return new CSVParser(in, this); } + /** + * Prints to the specified output. + * + *

+ * See also {@link CSVPrinter}. + *

+ * + * @param out + * the output + * @return a printer to an output + */ + public CSVPrinter print(final Appendable out) { + return new CSVPrinter(out, this); + } + @Override public String toString() { final StringBuilder sb = new StringBuilder(); Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1599285&r1=1599284&r2=1599285&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Mon Jun 2 18:04:49 2014 @@ -304,6 +304,15 @@ public class CSVPrinterTest { } @Test + public void testPrint() throws IOException { + final StringWriter sw = new StringWriter(); + final CSVPrinter printer = CSVFormat.DEFAULT.print(sw); + printer.printRecord("a", "b\\c"); + assertEquals("a,b\\c" + recordSeparator, sw.toString()); + printer.close(); + } + + @Test public void testPrintNullValues() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);