Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ZipInputStream  RSS feed

 
Derek Baker
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to open a .zip file (using a ZipInputStream) and read it line by line. I've tried to create a BufferedReader by passing the ZipInputStream through an InputStreamReader, but readLine() returns nothing but null. Any input or thoughts anyone might have would be greatly appreciated.

Derek
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A zip file is not a compressed file, it is an _archive_ of numerous compressed files, so you can't just grab a ZipInputStream and start reading it as if it were text. You have to obtain a particular ZipEntry within the ZipInputStream (i.e. file within the archive) and read it. Here's a good article on compression in Java that has plenty of examples of what I'm talking about.
 
Derek Baker
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you! That article was just what I needed.

Derek
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!