commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
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
want).

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
user.

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.

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message