Class ZipInputStreamZipEntrySource

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ZipEntrySource

    public class ZipInputStreamZipEntrySource
    extends java.lang.Object
    implements ZipEntrySource
    Provides a way to get at all the ZipEntries from a ZipInputStream, as many times as required. Allows a ZipInputStream to be treated much like a ZipFile, for a price in terms of memory. Be sure to call close() as soon as you're done, to free up that memory!
    • Constructor Detail

      • ZipInputStreamZipEntrySource

        public ZipInputStreamZipEntrySource​(ZipArchiveThresholdInputStream inp)
                                     throws java.io.IOException
        Reads all the entries from the ZipInputStream into memory, and don't close (since POI 4.0.1) the source stream. We'll then eat lots of memory, but be able to work with the entries at-will.
        Throws:
        java.io.IOException
    • Method Detail

      • close

        public void close()
        Description copied from interface: ZipEntrySource
        Indicates we are done with reading, and resources may be freed
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface ZipEntrySource
      • getEntry

        public ZipArchiveEntry getEntry​(java.lang.String path)
        Description copied from interface: ZipEntrySource
        Return an entry by its path
        Specified by:
        getEntry in interface ZipEntrySource
        Parameters:
        path - the path in unix-notation
        Returns:
        the entry or null if not found