英文:
Under what circumstances will the constructor of apache.commons.csv.CSVPrinter throw an IOException?
问题
根据 org.apache.commons.csv.CSVPrinter 的文档,如果无法打印可选的标题(在第二个参数中提供),将会抛出 IOException。但是是什么原因导致无法打印可选标题呢?是否有些字符串在标题中无效?
英文:
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?
答案1
得分: 1
根据<a href="https://github.com/apache/commons-csv/blob/master/src/main/java/org/apache/commons/csv/CSVPrinter.java">org.apache.commons.csv.CSVPrinter的源代码</a>,你所链接的构造函数会将任何标题注释和CSV标题(如果有)写入参数out中提供的输出流。由于这涉及向输出流写入,有可能会抛出IOException。
英文:
According to <a href="https://github.com/apache/commons-csv/blob/master/src/main/java/org/apache/commons/csv/CSVPrinter.java">the source of org.apache.commons.csv.CSVPrinter</a>, 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论