Class ZipFileUnpacker

    • Field Detail

      • extensions

        private static final Set<String> extensions
      • mimeTypes

        private static final Set<String> mimeTypes
    • Constructor Detail

      • ZipFileUnpacker

        public ZipFileUnpacker()
    • Method Detail

      • getFormatName

        public String getFormatName()
        Description copied from interface: FileUnpacker
        Get the name of the compressed file format this unpacker supports. For example: ZIP files
      • getExtensions

        public Set<String> getExtensions()
        Return a set containing the strings [ zip, jar ].
        Returns:
        A set containing file extensions (do not inlcude the dot)
      • getMimeTypes

        public Set<String> getMimeTypes()
        Return a set containing the strings [ application/zip, application/java-archive ].
        Returns:
        A set containing MIME types
      • unpack

        public int unpack​(DbControl dc,
                          Directory dir,
                          InputStream in,
                          File sourceFile,
                          boolean overwrite,
                          AbsoluteProgressReporter progress)
                   throws IOException
        Use the ZipUnpacker to unpack the file.
        Parameters:
        dc - The DbControl to use for database access
        dir - The directory to unpack the files to
        in - The input stream containing the packed data
        sourceFile - The source packed file that the input stream is coming from or null if not known
        overwrite - If existing files should be overwritten or ignored
        progress - A optional progress reporter which expects the number of compressed bytes that has been uncompressed
        Returns:
        The number of unpacked files
        Throws:
        IOException - If there is an error reading the input stream