You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2014/08/14 22:08:26 UTC

[jira] [Closed] (CSV-120) CSVFormat#withHeader doesn't work with CSVPrinter

     [ https://issues.apache.org/jira/browse/CSV-120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benedikt Ritter closed CSV-120.
-------------------------------


> CSVFormat#withHeader doesn't work with CSVPrinter
> -------------------------------------------------
>
>                 Key: CSV-120
>                 URL: https://issues.apache.org/jira/browse/CSV-120
>             Project: Commons CSV
>          Issue Type: Bug
>            Reporter: Sergei Lebedev
>            Priority: Minor
>             Fix For: 1.0
>
>
> In the current version [CSVFormat#withHeader|https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/CSVFormat.html#withHeader(java.lang.String...)] is only used by CSVParser. It would be nice if CSVPrinter also supported it. Ideally, the following line of code
> {code:java}
> CSVPrinter csvPrinter
>   = CSVFormat.TDF
>     .withHeader("x")
>     .print(Files.newBufferedWriter(Paths.get("data.csv")));
> csvPrinter.printRecord(42);
> csvPrinter.close();
> {code}
> should produce
> {code}
> x
> 42
> {code}
> If you're alright with the idea of automatically inserting headers, I can attach a patch.



--
This message was sent by Atlassian JIRA
(v6.2#6252)