Package io.mosip.kernel.core.util
Class ZipUtils
- java.lang.Object
-
- io.mosip.kernel.core.util.ZipUtils
-
public class ZipUtils extends Object
Utilities for Zip and UnZip operations. Provide Zip utility for usage across the application to Zip and unZip Files and Directory Size of the files and Folders according to business needs This ZipUtil will not applicable for RAR or 7Z etc.- Since:
- 1.0.0
- Author:
- Megha Tanga
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]unzipByteArray(byte[] input)Method used for unzipping a zipped Byte Arraystatic booleanunZipDirectory(String zipFilePath, String destDirectory)Extracts a zip file specified by the zipFilePath to a directory specified by destDirectory (will be created if does not exists)static byte[]zipByteArray(byte[] input)Method used for zipping a Byte Array
-
-
-
Method Detail
-
zipByteArray
public static byte[] zipByteArray(byte[] input) throws IOExceptionMethod used for zipping a Byte Array- Parameters:
input- pass Byte Array want to zip it- Returns:
- zipped Byte Array
- Throws:
IOException- when file unable to read
-
unzipByteArray
public static byte[] unzipByteArray(byte[] input) throws IOExceptionMethod used for unzipping a zipped Byte Array- Parameters:
input- pass zipped Byte Array want to unzip it- Returns:
- returned unzipped Byte Array
- Throws:
IOException- when file unable to readDataFormatException- Attempting to unzip file that is not zipped- See Also:
IOException
-
unZipDirectory
public static boolean unZipDirectory(String zipFilePath, String destDirectory) throws Exception
Extracts a zip file specified by the zipFilePath to a directory specified by destDirectory (will be created if does not exists)- Parameters:
zipFilePath- input zipped directory example: zipFilePath = "D:\\Testfiles\\test.zip";destDirectory- output unziped Directory example : outputUnZipDir = "D:\\Testfiles\\unZipDir";- Returns:
- true zip file extracted in given directory
- Throws:
FileNotFoundException- when file is not foundIOException- when file unable to readException
-
-