tags:

views:

44

answers:

2

I'm receiving a ZipInputStream from another source, and I need to provide the first entry's InputStream to another source.

I was hoping to be able to do this without saving a temp file on a device, however the only way I know of getting an InputStream for an individual entry is via ZipFile.getInputStream(entry) and since I have a ZipInputStream and not a ZipFile, that is not possible.

So the best solution I have is

  1. save incoming InputStream to a file
  2. read file as ZipFile
  3. use first entry's InputStream
  4. delete temp file.
A: 

figured:

it's entirely possible, the call to ZipInputStream.getNextEntry() positions the InputStream at the start of the entry and therefore supplying the ZipInputStream is the equivalent of supplying a ZipEntry's InputStream.

the ZipInputStream is smart enough to handle the entry's EOF downstream, or so it seems.

p.

pstanton
A: 

ZipInputStream.getNextEntry() returns ZipEntry object. There isn't any method to get the ZipEntry inputstream unless we have the zipfile. Is there anyway to get the inputstream from zipentry without the need to create zipfile?

I'm developing an application using google app engine which does not allow us to create temp folder to store zipfile.

this question is already answered. your answer sounds more like a question too. if the other answer is helpful to you, upvote it. if you have further questions, post a new question or comment on the existing question. p.
pstanton