Package de.uplanet.io
Class ZipHelper
java.lang.Object
de.uplanet.io.ZipHelper
IOHelper class utility
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Deprecated.static void
Deprecated.static void
Extract a ZIP archive to a directory.static void
static void
Deprecated.static boolean
Deprecated.static void
unzipDir
(ZipInputStream p_zip, File p_dirDst) Deprecated.static void
unzipDir
(ZipInputStream p_zip, String p_strPrefixFilter, File p_dirDst) Deprecated.static void
unzipDir
(ZipInputStream p_zip, Path p_dirDst) Extract a ZIP stream into a directory.static boolean
unzipDirectories
(ZipFile p_zip, Path p_dirDst, de.uplanet.util.Progress p_progress, boolean p_bExcludeMode, String... p_rootDirs) Copy a directory recursively from a ZIP file.
p_dirDst
is the parent directory of the new directory.static boolean
unzipDirectories
(ZipFile p_zip, Path p_dirDst, de.uplanet.util.Progress p_progress, String... p_rootDirs) Copy a directory recursively from a ZIP file.
p_dirDst
is the parent directory of the new directory.static void
Deprecated.static void
Copy a directory recursively to a ZIP file.static void
zipDir
(ZipOutputStream p_zip, String p_strRootDir, File p_dirSrc) Deprecated.static void
zipDir
(ZipOutputStream p_zip, String p_strRootDir, File p_dirSrc, boolean p_bZipMarkedDirs, Set<File> p_filesToExclude) Deprecated.static void
zipDir
(ZipOutputStream p_zip, String p_strRootDir, Path p_dirSrc) Copy a directory recursively to a ZIP output stream.static void
zipDir
(ZipOutputStream p_zip, String p_strRootDir, Path p_dirSrc, boolean p_bZipMarkedDirs, DirectoryStream.Filter<Path> p_filter) Copy a directory recursively to a ZIP output stream.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) Copy a directory recursively to a ZIP output stream.static void
zipDir
(ZipOutputStream p_zip, String p_strRootDir, Path p_dirSrc, boolean p_bZipMarkedDirs, Set<Path> p_filesToExclude) Deprecated.
-
Constructor Details
-
ZipHelper
public ZipHelper()
-
-
Method Details
-
zipDir
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 Deprecated.- 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 benull
).- 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 benull
).p_progress
- The progress. Could benull
.- Throws:
IOException
- If an I/O-error occurs.- Since:
- Intrexx 11.9.
-
unzipDir
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
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
- 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 benull
.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 benull
.p_bExcludeMode
- Iftrue
The directories given in rootDirs will be excludes otherwise only the directories given in p_rootDirs will unpakedp_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.- 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.- Throws:
IOException
-
unzipDir
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
-
zipDir(ZipOutputStream, String, Path, boolean, java.nio.file.DirectoryStream.Filter)
instead.