Class ZipFileOutputStream



  • public class ZipFileOutputStream
    extends java.io.BufferedOutputStream
    Represents an OutputStream to a provided File: In case the file points to a ZIP compressed file, then a therein to be contained file with the same name excluding the ".zip" extension is created by the OutputStream.
    • Field Summary

      • Fields inherited from class java.io.BufferedOutputStream

        buf, count
      • Fields inherited from class java.io.FilterOutputStream

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      ZipFileOutputStream​(java.io.File aFile)
      Instantiates a new zip file output stream impl.
      ZipFileOutputStream​(java.io.File parent, java.lang.String child)
      Instantiates a new zip file output stream impl.
      ZipFileOutputStream​(java.lang.String pathname)
      Instantiates a new zip file output stream impl.
      ZipFileOutputStream​(java.lang.String parent, java.lang.String child)
      Instantiates a new zip file output stream impl.
      ZipFileOutputStream​(java.net.URI uri)
      Instantiates a new zip file output 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)
      To file name from zip.
      protected static java.io.OutputStream toOutputStream​(java.io.File aFile)
      Returns an OutputStream to the provided File.
      • Methods inherited from class java.io.BufferedOutputStream

        flush, write, write
      • Methods inherited from class java.io.FilterOutputStream

        close, write
      • Methods inherited from class java.lang.Object

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

      • ZipFileOutputStream

        public ZipFileOutputStream​(java.io.File parent,
                                   java.lang.String child)
                            throws java.util.zip.ZipException,
                                   java.io.FileNotFoundException,
                                   java.io.IOException
        Instantiates a new zip file output 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.
      • ZipFileOutputStream

        public ZipFileOutputStream​(java.lang.String parent,
                                   java.lang.String child)
                            throws java.util.zip.ZipException,
                                   java.io.FileNotFoundException,
                                   java.io.IOException
        Instantiates a new zip file output 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.
      • ZipFileOutputStream

        public ZipFileOutputStream​(java.lang.String pathname)
                            throws java.util.zip.ZipException,
                                   java.io.FileNotFoundException,
                                   java.io.IOException
        Instantiates a new zip file output 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.
      • ZipFileOutputStream

        public ZipFileOutputStream​(java.net.URI uri)
                            throws java.util.zip.ZipException,
                                   java.io.FileNotFoundException,
                                   java.io.IOException
        Instantiates a new zip file output 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.
      • ZipFileOutputStream

        public ZipFileOutputStream​(java.io.File aFile)
                            throws java.util.zip.ZipException,
                                   java.io.FileNotFoundException,
                                   java.io.IOException
        Instantiates a new zip file output 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

      • toOutputStream

        protected static java.io.OutputStream toOutputStream​(java.io.File aFile)
                                                      throws java.util.zip.ZipException,
                                                             java.io.IOException,
                                                             java.io.FileNotFoundException
        Returns an OutputStream to the provided File. In case the file points to a ZIP compressed file (it has the file suffix ".zip"), then the data written to the OutputStream is being ZIP compressed.
        Parameters:
        aFile - The File for which to get the OutputStream.
        Returns:
        An OutputStream, in case of a ZIP compressed File was specified (with suffix ".zip"), then a compressed OutputStream 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)
        To file name from zip.
        Parameters:
        aZipFileName - the zip file name
        Returns:
        the string
        See Also:
        ZipFileInputStream.toFileNameFromZip(String)