Designing a library that can handle CSV files

I need help with designing a java library that can handle csv files. Can you please help me on how to go about creating a library that can do so? as well as creating a test application for the library. Please help. Thanks a lot.
java isn't c++.

csv is just a plain text file with commas in it. That's all it is.

If you are writing some sort of serious product consider jacking in a spreadsheet library and using that (even if hidden from the user, it can still do most of the work for you). Probably some way to stick an openoffice widget in (portable) or visual can put an excel widget in, etc.


Well I need to create a java library to do this, and im new to java. I just need to know how to atleast start this off right. Thanks
ProgrammerXYZ wrote:
Well I need to create a java library to do this.

I just need to know how to at least start this off right


http://www.javaprogrammingforums.com/



this is a forum for a completely different language. Some people here know java, and most of us can read it since its more or less busted c++ code, but you are in the wrong place. This is like asking how to write an assembly language program in the visual basic topic area. You might get an answer, but its totally off topic and not a good place to get the best answer.

jonnin wrote:
csv is just a plain text file with commas in it. That's all it is.

Uh, that is literally the dumbest thing I've ever seen you write.

DSV files are anything but simple. There is a whole lot of headache to reading them properly. Most of the time, people get along by restricting the kind and/or format of data that their DSV reader can handle.

I'm pretty sure Java has a halfway decent CSV reader in one of its libraries... but I'm not going to google that for you.

If you are up to rolling your own, make sure to check out:

  How To:
  The Comma Separated Value (CSV) File Format
  http://creativyst.com/Doc/Articles/CSV/CSV01.htm

which remains one of the best documents out there for understanding the complexities of writing a CSV parser. (Hint: use a state machine.)

You can also refer to the RFC 4180 spec, which is more prescriptive than descriptive, and is therefore (IMHO) not a very useful resource for writing a reader that can deal with existing DSV data, but is a good starting point for your own restricted subset of extant DSV formats.
https://tools.ietf.org/html/rfc4180

Good luck!
Topic archived. No new replies allowed.