Amit Amit - 3 months ago 6
Java Question

Does ZipInputStream in JAVA refers to data in compressed data?

I am working on small module where I want to read the data from ZIP file using streaming. ZIP size is large and I want to keep

ZipInputStream
reference in memory for longer duration.

So I have two basic questions:


  1. Does
    ZipInputStream
    holds whole ZIP data in memory?

  2. Is data referred by
    ZipInputStream
    in compressed format?


Answer

ZipInputStream do not work with .zip files. You should use ZipFile instead.

ZipInputStream doesn't hold all content in memory. It process data on the fly.