Package de.uplanet.io

Class ZipHelper


  • @Scriptable
    public final class ZipHelper
    extends Object
    IOHelper class utility
    • Constructor Detail

      • ZipHelper

        public ZipHelper()
    • Method Detail

      • zipDir

        public static void zipDir​(Path p_fileZip,
                                  Path p_dirSrc)
                           throws IOException
        Copy a directory recursively to a ZIP file.
        Parameters:
        p_fileZip - The output file.
        p_dirSrc - The directory to be archived.
        Throws:
        IOException - If an I/O-error occurs.
      • zipDir

        public static void zipDir​(ZipOutputStream p_zip,
                                  String p_strRootDir,
                                  Path p_dirSrc)
                           throws IOException
        Copy a directory recursively to a ZIP output stream.
        Parameters:
        p_zip - A ZIP output stream.
        p_strRootDir - The root directory for the added files, or null, if top level.
        p_dirSrc - The directory to copy.
        Throws:
        IOException - If an I/O-error occurs.
      • zipDir

        public static void zipDir​(ZipOutputStream p_zip,
                                  String p_strRootDir,
                                  Path p_dirSrc,
                                  boolean p_bZipMarkedDirs,
                                  DirectoryStream.Filter<Path> p_filter)
                           throws IOException
        Copy a directory recursively to a ZIP output stream.

        p_dest is the parent directory of the new directory.

        Parameters:
        p_zip - The ZIP output stream.
        p_strRootDir - The root directory for the added files, or null, if top level.
        p_dirSrc - The directory to copy.
        p_bZipMarkedDirs - Zips directories, even if they are marked with a ".noexport" file. If this parameter is set to false, the destination directory entry is created with a .noxexport entry as the only content.
        p_filter - A filter for files and directories (must not be null).
        Throws:
        IOException - If an I/O-error occurs.
        Since:
        Intrexx 9.0.
      • unzipDir

        public static void unzipDir​(ZipInputStream p_zip,
                                    String p_strPrefixFilter,
                                    Path p_dirDst)
                             throws IOException
        Extract a ZIP stream into a directory.
        Parameters:
        p_zip - The stream to be uzipped.
        p_strPrefixFilter - A prefix for the files that are to be extracted, or null if all files should be extracted. Forward slashes are used as path delimiters.
        p_dirDst - The destination directory.
        Throws:
        IOException - If an I/O-error occurs.
      • unzipDir

        public static void unzipDir​(Path p_fileZip,
                                    Path p_dirDst)
                             throws IOException
        Extract a ZIP archive to a directory.
        Parameters:
        p_fileZip - The file to be uzipped.
        p_dirDst - The destination directory.
        Throws:
        IOException - If an I/O-error occurs.
      • unzipDir

        public static void unzipDir​(ZipFile p_zip,
                                    String p_strRootDir,
                                    Path p_dirDst)
                             throws IOException
        This method calls unzipDir(ZipFile, String, Path, Progress) with a null progress parameter.
        Parameters:
        p_zip - The file to be uzipped.
        p_strRootDir - The root dir of the files in the zip, or null, if top level.
        p_dirDst - The destination directory.
        Throws:
        IOException - If an I/O-error occurs.
      • unzipDir

        public static boolean unzipDir​(ZipFile p_zip,
                                       String p_strRootDir,
                                       Path p_dirDst,
                                       de.uplanet.util.Progress p_progress)
                                throws IOException
        Copy a directory recursively from a ZIP file.
        p_dirDst is the parent directory of the new directory.
        Parameters:
        p_zip - The file to be uzipped.
        p_strRootDir - The root dir of the files in the zip, or null, if top level.
        p_dirDst - The destination directory.
        p_progress - The progress callback to be used. May be null.
        Returns:
        true, if this method created any files or directories, false otherwise
        Throws:
        IOException - If an I/O-error occurs.