I need a bit of help ...

10 views
Skip to first unread message

AdrianBlakey

unread,
Apr 8, 2010, 2:13:42 AM4/8/10
to io-tools
I have looked at the unit tests and read the tutorial, but try as I
might I can not understand how to use this to do what I want.

Care to provide a hint?

I want to read a zip file, and stream it to a parser.

I can read from the zip input stream, and write to an output stream.
The CSV parser constructor wants a Reader. How do I use
OutputStreamToInputStream to wire the zip output stream to the parser
input reader?

dvd.smnt

unread,
Apr 12, 2010, 5:09:14 AM4/12/10
to io-tools
I'm not sure you need this library... maybe you can get your work done
simply with the standard java classes.

ZipFile zf=new ZipFile(myfile);
for(ZipEntry entry : zf.entries()){
InputStream is=entry.getInputStream();
Reader reader=new InputStreamReader(is);
// Reader reader=new InputStreamReader(is,"UTF-8"); if you need
to specify the encoding

CSVParser csvParser=new CSVParser(reader);
.....
}

Let me know if this solves your problem.

Reply all
Reply to author
Forward
0 new messages