Package gov.niem.tools.api.core.utils
Class ZipUtils
java.lang.Object
gov.niem.tools.api.core.utils.ZipUtils
Zipfile-related utility functions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Path
Unzips the zip file at the given path to a temporary folder.static Path
Unzips the zip file at the given path to a temporary folder.static void
Zips the contents of the given source directory to the specified path.static net.lingala.zip4j.ZipFile
Adds a file to the given zip file.static byte[]
Returns a byte array for a zipfile of the given list of files.
-
Constructor Details
-
ZipUtils
public ZipUtils()
-
-
Method Details
-
zip
Returns a byte array for a zipfile of the given list of files.- Throws:
Exception
-
zip
public static void zip(File sourceDir, String zipFilePathString) throws net.lingala.zip4j.exception.ZipException, IOException Zips the contents of the given source directory to the specified path.- Throws:
net.lingala.zip4j.exception.ZipException
IOException
-
zip
public static net.lingala.zip4j.ZipFile zip(String zipFilePathString, List<File> files) throws net.lingala.zip4j.exception.ZipException, IOException Adds a file to the given zip file.- Throws:
net.lingala.zip4j.exception.ZipException
IOException
-
unzip
Unzips the zip file at the given path to a temporary folder.- Returns:
- - Path to the temporary folder where the files have been extracted.
- Throws:
IOException
-
unzip
Unzips the zip file at the given path to a temporary folder.- Returns:
- - Path to the temporary folder where the files have been extracted.
- Throws:
IOException
-