Package de.uplanet.io

Class ZipHelper

java.lang.Object
de.uplanet.io.ZipHelper

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

    • ZipHelper

      public ZipHelper()
  • Method Details

    • 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

      @Deprecated public static void zipDir(ZipOutputStream p_zip, String p_strRootDir, Path p_dirSrc, boolean p_bZipMarkedDirs, Set<Path> p_filesToExclude) throws IOException
      Throws:
      IOException
    • 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.
    • zipDir

      public static void zipDir(ZipOutputStream p_zip, String p_strRootDir, Path p_dirSrc, boolean p_bZipMarkedDirs, DirectoryStream.Filter<Path> p_filter, de.uplanet.util.Progress p_progress) 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).
      p_progress - The progress. Could be null.
      Throws:
      IOException - If an I/O-error occurs.
      Since:
      Intrexx 11.9.
    • unzipDir

      public static void unzipDir(ZipInputStream p_zip, Path p_dirDst) throws IOException
      Extract a ZIP stream into a directory.

      For security reasons this method prevents files from being created outside the specified destination directory.

      Parameters:
      p_zip - The stream to be uzipped.
      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(Path p_zip, Path p_dirDst, String p_strEncoding) throws IOException
      Throws:
      IOException
    • unzipDirectories

      public static boolean unzipDirectories(ZipFile p_zip, Path p_dirDst, de.uplanet.util.Progress p_progress, String... p_rootDirs) 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_dirDst - The destination directory.
      p_progress - The progress callback to be used. May be null.
      p_rootDirs - The root dirs of the files in the zip, or none if top level, Entry started with --exclude: will be excluded.
      Returns:
      true, if this method created any files or directories, false otherwise
      Throws:
      IOException - If an I/O-error occurs.
    • unzipDirectories

      public static boolean unzipDirectories(ZipFile p_zip, Path p_dirDst, de.uplanet.util.Progress p_progress, boolean p_bExcludeMode, String... p_rootDirs) 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_dirDst - The destination directory.
      p_progress - The progress callback to be used. May be null.
      p_bExcludeMode - If true The directories given in rootDirs will be excludes otherwise only the directories given in p_rootDirs will unpaked
      p_rootDirs - The root dirs of the files in the zip, or none if top level.
      Returns:
      true, if this method created any files or directories, false otherwise
      Throws:
      IOException - If an I/O-error occurs.
      Since:
      11.9
    • zipDir

      @Deprecated public static void zipDir(File p_fileZip, File p_dirSrc) throws IOException
      Deprecated.
      Throws:
      IOException
    • zipDir

      @Deprecated public static void zipDir(ZipOutputStream p_zip, String p_strRootDir, File p_dirSrc) throws IOException
      Deprecated.
      Throws:
      IOException
    • zipDir

      @Deprecated public static void zipDir(ZipOutputStream p_zip, String p_strRootDir, File p_dirSrc, boolean p_bZipMarkedDirs, Set<File> p_filesToExclude) throws IOException
      Deprecated.
      Throws:
      IOException
    • unzipDir

      @Deprecated public static void unzipDir(ZipInputStream p_zip, String p_strPrefixFilter, File p_dirDst)
      Deprecated.
    • unzipDir

      @Deprecated public static void unzipDir(ZipInputStream p_zip, File p_dirDst) throws IOException
      Deprecated.
      Throws:
      IOException
    • unzipDir

      @Deprecated public static void unzipDir(File p_fileZip, File p_dirDst) throws IOException
      Deprecated.
      Throws:
      IOException
    • unzipDir

      @Deprecated public static void unzipDir(File p_zip, File p_dirDst, String p_strEncoding) throws IOException
      Deprecated.
      Throws:
      IOException
    • unzipDir

      @Deprecated public static void unzipDir(ZipFile p_zip, String p_strRootDir, File p_dirDst) throws IOException
      Deprecated.
      Throws:
      IOException
    • unzipDir

      @Deprecated public static boolean unzipDir(ZipFile p_zip, String p_strRootDir, File p_dirDst, de.uplanet.util.Progress p_progress) throws IOException
      Deprecated.
      Throws:
      IOException