Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
In the current version CSVFormat#withHeader is only used by CSVParser. It would be nice if CSVPrinter also supported it. Ideally, the following line of code
CSVPrinter csvPrinter = CSVFormat.TDF .withHeader("x") .print(Files.newBufferedWriter(Paths.get("data.csv"))); csvPrinter.printRecord(42); csvPrinter.close();
should produce
x 42
If you're alright with the idea of automatically inserting headers, I can attach a patch.