Package eu.woolplatform.utils.io
Class ZipUtils
- java.lang.Object
-
- eu.woolplatform.utils.io.ZipUtils
-
public class ZipUtils extends Object
This class contains static utility methods for zip files.
-
-
Constructor Summary
Constructors Constructor Description ZipUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidunzip(File zipFile, File outputDir)Unzips a zip file to the specified output directory.static voidzipFile(File srcFile, File zipFile)Creates a ZIP file containing only the specified source file.static voidzipFileSet(File rootDir, List<File> files, File zipFile)Creates a ZIP file containing a specified set of files within a root directory.
-
-
-
Method Detail
-
unzip
public static void unzip(File zipFile, File outputDir) throws IOException
Unzips a zip file to the specified output directory.- Parameters:
zipFile- the zip fileoutputDir- the output directory- Throws:
IOException- if a reading or writing error occurs
-
zipFile
public static void zipFile(File srcFile, File zipFile) throws IOException
Creates a ZIP file containing only the specified source file.- Parameters:
srcFile- the source filezipFile- the ZIP file- Throws:
IOException- if a reading or writing error occurs
-
zipFileSet
public static void zipFileSet(File rootDir, List<File> files, File zipFile) throws IOException
Creates a ZIP file containing a specified set of files within a root directory. The root directory is used to obtain the relative path to each file in the set. The relative paths are stored in the ZIP file.- Parameters:
rootDir- the root directoryfiles- the files to add to the ZIP filezipFile- the ZIP file- Throws:
IOException- if a reading or writing error occurs
-
-