• Post Reply Bookmark Topic Watch Topic
  • New Topic

ZipInputStream sometimes behaves as expected sometimes not  RSS feed

 
Tapio Niemela
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get InputStream-objects (to be passed to another class) from a zip-file, which consists of xml-files. The problem is that sometimes I can get it correctly, but sometimes I got FileNotFoundException. It seems to depend on the zip-file, maybe those are extracted into temp, or something behind the scenes..

here's the relevant code:

 
Rob Spoor
Sheriff
Posts: 21095
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're using FileInputStream, which looks for files in your file system. For ZIP entries you should use the ZipInputStream itself. Every time you call getNextEntry, this will reposition itself to the new file.

So:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!