0

I have org.apache.commons.compress.archivers.zip.ZipArchiveInputStream Object, from which I can get each ArchiveEntry item and get the individual file's metadata. But I need to know the way to get each file's contents as Blob.

Using org.apache.commons.compress.archivers.zip.ZipFile it can be done, but ZipFile has constructors with physical or temporary File object or a file location. I dont want to create a temporary File for this.

Even if there is a way to convert ZipArchiveInputStream to ZipFile, it would solve the problem indirectly.

In short, my requirement is to read a Zip file from an InputStream/Blob and store individual Files as BLOB in Database.

FYI: I am using org.apache.commons :: commons-compress :: 1.4.1

Any solutions/ideas/suggestions are highly appreciated.

Cheers Kum

Kumaran
  • 19
  • 1
  • 3

1 Answers1

0

perhaps you could use standard java.util.zip.ZipInputStream - it has a constructor for InputStream. you can use getNextEntry() / closeEntry() to iterate through entries and read() to obtain decompressed data.

mantrid
  • 2,830
  • 21
  • 18