apache.commons.csv.CSVPrinter的构造函数在什么情况下会抛出IOException?

huangapple go评论64阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年7月24日 03:11:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/63061534.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定