Class ZipFileInputStream



  • public class ZipFileInputStream
    extends java.io.BufferedInputStream
    Represents an InputStream from a provided File: In case the file points to a ZIP compressed file, then the uncompressed data of the therein contained file with the same name excluding the ".zip" extension is provided by the InputStream.
    • Field Summary

      • Fields inherited from class java.io.BufferedInputStream

        buf, count, marklimit, markpos, pos
      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Constructor Description
      ZipFileInputStream​(java.io.File aFile)
      Instantiates a new zip file input stream impl.
      ZipFileInputStream​(java.io.File parent, java.lang.String child)
      Instantiates a new zip file input stream impl.
      ZipFileInputStream​(java.lang.String pathname)
      Instantiates a new zip file input stream impl.
      ZipFileInputStream​(java.lang.String parent, java.lang.String child)
      Instantiates a new zip file input stream impl.
      ZipFileInputStream​(java.net.URI uri)
      Instantiates a new zip file input stream impl.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.lang.String toFileNameFromZip​(java.lang.String aZipFileName)
      Truncates the ".zip" suffix from the filename and returns the result.
      protected static java.io.InputStream toInputStream​(java.io.File aFile)
      Returns an InputStream from the provided File.
      • Methods inherited from class java.io.BufferedInputStream

        available, close, mark, markSupported, read, read, reset, skip
      • Methods inherited from class java.io.FilterInputStream

        read
      • Methods inherited from class java.io.InputStream

        readAllBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • ZipFileInputStream

        public ZipFileInputStream​(java.io.File parent,
                                  java.lang.String child)
                           throws java.util.zip.ZipException,
                                  java.io.FileNotFoundException,
                                  java.io.IOException
        Instantiates a new zip file input stream impl.
        Parameters:
        parent - the parent
        child - the child
        Throws:
        java.util.zip.ZipException - the zip exception
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - Signals that an I/O exception has occurred.
      • ZipFileInputStream

        public ZipFileInputStream​(java.lang.String parent,
                                  java.lang.String child)
                           throws java.util.zip.ZipException,
                                  java.io.FileNotFoundException,
                                  java.io.IOException
        Instantiates a new zip file input stream impl.
        Parameters:
        parent - the parent
        child - the child
        Throws:
        java.util.zip.ZipException - the zip exception
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - Signals that an I/O exception has occurred.
      • ZipFileInputStream

        public ZipFileInputStream​(java.lang.String pathname)
                           throws java.util.zip.ZipException,
                                  java.io.FileNotFoundException,
                                  java.io.IOException
        Instantiates a new zip file input stream impl.
        Parameters:
        pathname - the pathname
        Throws:
        java.util.zip.ZipException - the zip exception
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - Signals that an I/O exception has occurred.
      • ZipFileInputStream

        public ZipFileInputStream​(java.net.URI uri)
                           throws java.util.zip.ZipException,
                                  java.io.FileNotFoundException,
                                  java.io.IOException
        Instantiates a new zip file input stream impl.
        Parameters:
        uri - the uri
        Throws:
        java.util.zip.ZipException - the zip exception
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - Signals that an I/O exception has occurred.
      • ZipFileInputStream

        public ZipFileInputStream​(java.io.File aFile)
                           throws java.util.zip.ZipException,
                                  java.io.FileNotFoundException,
                                  java.io.IOException
        Instantiates a new zip file input stream impl.
        Parameters:
        aFile - the file
        Throws:
        java.util.zip.ZipException - the zip exception
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - Signals that an I/O exception has occurred.
    • Method Detail

      • toInputStream

        protected static java.io.InputStream toInputStream​(java.io.File aFile)
                                                    throws java.util.zip.ZipException,
                                                           java.io.IOException,
                                                           java.io.FileNotFoundException
        Returns an InputStream from the provided File. In case the file points to a ZIP compressed file, then the uncompressed data is provided by the InputStream.
        Parameters:
        aFile - The File for which to get the InputStream.
        Returns:
        An InputStream, in case of a ZIP compressed File, an uncompressed InputStream is returned.
        Throws:
        java.util.zip.ZipException - in case there were problems when accessing the ZIP compressed File.
        java.io.IOException - in case there were problems working with the File.
        java.io.FileNotFoundException - in case there was none such File found.
      • toFileNameFromZip

        protected static java.lang.String toFileNameFromZip​(java.lang.String aZipFileName)
        Truncates the ".zip" suffix from the filename and returns the result. For example a file with name "log-2023-07-12.txt.zip" results in "log-2023-07-12.txt".
        Parameters:
        aZipFileName - The file name of the ZIP file for which to get the "inner" file name.
        Returns:
        The "inner" file name if the file suffix was ".zip", else null.