开发者

java: csv...do I need a library? [closed]

开发者 https://www.devze.com 2023-02-10 18:49 出处:网络
开发者_开发技巧 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely so
开发者_开发技巧 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

Do I need a library if I only need to make csv formatted file. I don't need reading and parsing it.


No, you don't. And even reading/parsing can be easily done with a plain JRE.

CSV is a plain (ascii-)text format with only a few rules:

  • rows (objects) are separated with a \n
  • columns (fields, attributes) are spearated with a delimiter char (usually a comma, but define whatever you need)
  • row and column delimiters must not be part of the field values


Unless it's a really trivial part of your application and you're absolutely sure you won't ever need to parse a CSV file, you need a CSV-serialization library.

I have tried openCSV and I'm pretty happy using it. Of course you can write your own class to handle this serialization, but a library always comes with more features at the expense of an extra dependency...

0

精彩评论

暂无评论...
验证码 换一张
取 消