Class NestedZipFile

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

    public final class NestedZipFile
    extends java.util.zip.ZipFile
    This class provides more details about the underlying ZIP file as the original ZipFile class. E.g. it has a useful toString() implementation which gives you the name of the file. And it allows you to use nested ZIP files, e.g. ZIP files inside ZIP files.
    Since:
    1.8 (24.01.2017)
    Version:
    $Revision: 1.4 $
    Author:
    oboehm
    • Constructor Summary

      Constructors 
      Constructor Description
      NestedZipFile​(java.io.File file)
      Instantiates a new detailed zip file.
      NestedZipFile​(java.io.File file, int mode)
      Instantiates a new detailed zip file.
      NestedZipFile​(java.io.File file, int mode, java.nio.charset.Charset charset)
      Instantiates a new detailed zip file.
      NestedZipFile​(java.io.File file, java.nio.charset.Charset charset)
      Instantiates a new detailed zip file.
      NestedZipFile​(java.lang.String name)
      Instantiates a new detailed zip file.
      NestedZipFile​(java.lang.String name, java.nio.charset.Charset charset)
      Instantiates a new detailed zip file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String toString()
      In contrast to the super class this method provides the name of the ZIP file.
      • Methods inherited from class java.util.zip.ZipFile

        close, entries, finalize, getComment, getEntry, getInputStream, getName, size, stream
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NestedZipFile

        public NestedZipFile​(java.lang.String name)
                      throws java.io.IOException
        Instantiates a new detailed zip file.
        Parameters:
        name - the name
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • NestedZipFile

        public NestedZipFile​(java.io.File file)
                      throws java.io.IOException
        Instantiates a new detailed zip file.
        Parameters:
        file - a normal file or a nested ZIP file (e.g. "file:/a.jar!/b.jar")
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • NestedZipFile

        public NestedZipFile​(java.io.File file,
                             int mode)
                      throws java.io.IOException
        Instantiates a new detailed zip file.
        Parameters:
        file - the file
        mode - the mode
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • NestedZipFile

        public NestedZipFile​(java.lang.String name,
                             java.nio.charset.Charset charset)
                      throws java.io.IOException
        Instantiates a new detailed zip file.
        Parameters:
        name - the name
        charset - the charset
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • NestedZipFile

        public NestedZipFile​(java.io.File file,
                             java.nio.charset.Charset charset)
                      throws java.io.IOException
        Instantiates a new detailed zip file.
        Parameters:
        file - the file
        charset - the charset
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • NestedZipFile

        public NestedZipFile​(java.io.File file,
                             int mode,
                             java.nio.charset.Charset charset)
                      throws java.io.IOException
        Instantiates a new detailed zip file.
        Parameters:
        file - the file
        mode - the mode
        charset - the charset
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
    • Method Detail

      • toString

        public java.lang.String toString()
        In contrast to the super class this method provides the name of the ZIP file.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string