1

Is it possible that if an ArchiveEntry coming from an ArchiveInputStream in the apache commons compress lib is another Archive, that I could then uncompress that archiveEntry into memory?

Thanks

Derek
  • 11,715
  • 32
  • 127
  • 228

1 Answers1

1

Yes, it is possible. APIs that work with streams will work with ByteArrayInputStream and ByteArrayOutputStream.

If you show a code sample of what you're doing now, I will give you a more specific answer, but the idea is to read the uncompressed data into a byte array, then create a ByteArrayInputStream from it and feed it to the second ArchiveInputStream.

biziclop
  • 48,926
  • 12
  • 77
  • 104
  • Can you provide an example? ArchiveEntry doesnt seem to have any way to get a stream. The ArchiveEntry itself comes from an ArchiveInputStream in my case but I would like to convert the ArchiveEntry into an in-memory file to pass it back to my function that needs to read it – Derek Apr 20 '12 at 18:08
  • 1
    Also, it seems like the createArchiveOutputStream from the factory requires that you name the type of the archive. How do I get the type of the ArchiveEntry? – Derek Apr 20 '12 at 18:10