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...
精彩评论