views:

50

answers:

1

Hi,

I have to pass an InputStream as a parameter to a 3rd party library, which will read the complete contents from the InputStream and do its job.

My problem is, some of my files are Zip files - with more than one ZipEntry. From what I understand, one can read one zipEntry at a time and then do a zipInputStream.getNextEntry() and then again read and so on. But, the 3rd party library doesn't understand this and expects a single InputStream. All the zipEntries of a zip file should be available as a single inputStream.

Please enlighten me as to how to do it. I cannot use ZipFile as the file is not stored locally (in a different server). I also cannot read all zipEntries and construct a ByteArrayOutputStream or a string as the files can be very big and that will spike memory usage.

I want a way to let one inputStream read from multiple zip entries of a single zip file transparantly.

thanks in advance, Prasanna

A: 

Hi Rob,

No, I am not using SharpZipLib. Mine is a Java application (and I am new to Java). Let me state in another way. I have to get a InputStream for a file from a File Server and hand that InputStream over to another. Since the reader only reads one InputStream, I have problem in giving ZipInputStream as a single inputStream.

Is it possible for me to override read method of InputStream or ZipInputStream such that a single read operation reads all the ZipEntries of a ZipInputStream ? Please let me know how to do that.

thanks, Prasanna

Prasanna