Package org.brijframework.util.location
Class ZipUtil
- java.lang.Object
-
- org.brijframework.util.location.ZipUtil
-
public class ZipUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description ZipUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcreateFileStrFromByteArrayToLocalDisk(byte[] zippedByteData, File outputDir)static voidcreateZipFileFromByteArrayToLocalDisk(byte[] zippedByteData, File outputDir, String zipFileName)static booleanfileCompress(String formReadFileName, String toWriteFileName)static StringfileUnCompress(String formReadFileName)static byte[]getByteArrayFromZipFile(File zipFileName)static byte[]getBytesAftrZippingFolder(File inFolder)static FilegetCurrentDir()static List<File>getFiles(File file)static StringloadCompressFile(File formReadFileName, File toWriteFileName)static StringloadCompressFile(String formReadFileName)static ArrayList<?>loadFilesFromJarOrDirectly(String dirPath, URL dirUrl)static voidmain(String[] args)static voidsetCurrentDir(File currentDir)static voidunzip(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 voidunZipFolder(String zipFile, String outZipFileName)voidzip(String[] files, String destZipFile)Compresses files represented in an array of pathsvoidzip(List<File> listFiles, String destZipFile)Compresses a list of files to a destination zip file
-
-
-
Method Detail
-
getBytesAftrZippingFolder
public static byte[] getBytesAftrZippingFolder(File inFolder)
-
createZipFileFromByteArrayToLocalDisk
public static void createZipFileFromByteArrayToLocalDisk(byte[] zippedByteData, File outputDir, String zipFileName)
-
getByteArrayFromZipFile
public static byte[] getByteArrayFromZipFile(File zipFileName)
-
createFileStrFromByteArrayToLocalDisk
public static void createFileStrFromByteArrayToLocalDisk(byte[] zippedByteData, File outputDir)
-
getCurrentDir
public static File getCurrentDir()
-
setCurrentDir
public static void setCurrentDir(File currentDir)
-
zip
public void zip(List<File> listFiles, String destZipFile) throws FileNotFoundException, IOException
Compresses a list of files to a destination zip file- Parameters:
listFiles- A collection of files and directoriesdestZipFile- The path of the destination zip file- Throws:
FileNotFoundExceptionIOException
-
zip
public void zip(String[] files, String destZipFile) throws FileNotFoundException, IOException
Compresses files represented in an array of paths- Parameters:
files- a String array containing file pathsdestZipFile- The path of the destination zip file- Throws:
FileNotFoundExceptionIOException
-
unzip
public static void unzip(String zipFilePath, String destDirectory) throws IOException
Extracts a zip file specified by the zipFilePath to a directory specified by destDirectory (will be created if does not exists)- Parameters:
zipFilePath-destDirectory-- Throws:
IOException
-
fileUnCompress
public static String fileUnCompress(String formReadFileName) throws Exception
- Throws:
Exception
-
fileCompress
public static boolean fileCompress(String formReadFileName, String toWriteFileName) throws IOException
- Throws:
IOException
-
loadCompressFile
public static String loadCompressFile(File formReadFileName, File toWriteFileName) throws Exception
- Throws:
Exception
-
loadCompressFile
public static String loadCompressFile(String formReadFileName) throws Exception
- Throws:
Exception
-
loadFilesFromJarOrDirectly
public static ArrayList<?> loadFilesFromJarOrDirectly(String dirPath, URL dirUrl)
-
main
public static void main(String[] args) throws IOException
- Throws:
IOException
-
-