0

According to the documentation of org.apache.commons.csv.CSVPrinter, an IOException will be thrown "if the optional header [provided in the second argument] cannot be printed". But what would cause the optional header to be unable to print? Are some strings somehow invalid in the header?

Mathew Alden
  • 1,458
  • 2
  • 15
  • 34

1 Answers1

1

According to the source of org.apache.commons.csv.CSVPrinter, the constructor you link to writes any header comments, and the CSV header (if used), to the output stream given in the parameter out. As this involves writing to the output stream, there is the possibility that an IOException may be thrown.

Luke Woodward
  • 63,336
  • 16
  • 89
  • 104
  • Oooh. When I was reading the documentation, I thought it was implying that some headers were invalid, but it was simply saying that some Appendables throw IOExceptions. Got it. Thanks. – Mathew Alden Jul 23 '20 at 20:22