commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: CSV parsing/writing?
Date Fri, 27 May 2005 11:21:27 GMT
On Fri, 2005-05-27 at 14:10 +0300, Catalin Grigoroscuta wrote:
> Hi,
> Unfortunately, reading the entire CVS into memory is not always a good 
> thing.
> Stream-like API should be available for parsing large CSV files 
> (resulted from database tables export to CSV, for exmaple)

Yep, this sort of pattern is quite popular and very flexible.

Obviously xml is a prime example: an event-based parser emits events to
a listener. If the user wants a complete in-memory representation, then
they plug in a listener that generates a DOM tree (or whatever they

The ASM java bytecode manipulation lib is similar. A java .class file
reader emits events. If the user wants an in-memory representation of
the class structure, they attach the appropriate listener to build one.

It's much more flexible than an API that *always* loads everything into
memory, and stores it in a datastructure that it has decided, not the

I'm not volunteering to work on a csv parsing project..but I would
second this suggestion. It's only an extra couple of classes, and makes
the result much more flexible.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message