Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.0
-
Component/s: None
-
Labels: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.