public class BackupRestoreUtil extends Object
| Constructor and Description |
|---|
BackupRestoreUtil() |
| Modifier and Type | Method and Description |
|---|---|
static File |
getHashFile(File zipFile)
Gets the hash file associated with the zipFile.
|
static File |
pack(String sourceDir,
String targetDir,
String filter,
String zipFileName)
Creates a zip file after zipping the contents of the sourceDir
directory based on a specific filter
|
static File |
packDirectory(String sourceDir,
String targetDir,
String directoryName,
String zipFileName,
String pathRemove)
Creates a zip file after zipping the contents of the sourceDir
directory based on a specific directory name
|
static File |
packWithHash(String sourceDir,
String targetDir,
String filter,
String zipFileName)
Creates a zip file of a directory after calculating the MD5 Hash of all
the files present in the directory.
|
static File |
unPack(File zipToUnbundle,
String targetDir)
Unzips a zip file, upon its validation, to the specified path
|
static boolean |
verifyHash(File zipFile,
File hashFile)
Verifies the integrity of a file.
|
public static File pack(String sourceDir, String targetDir, String filter, String zipFileName)
sourceDir - - The file name of the source folder whose contents
are to be zippedtargetDir - - The file name of the directory where the zip files
are to be kept on successful zip operationfilter - - The regular expression string which is used as a filter
to zip only the required fileszipFileName - - The name of the created zip filepublic static File unPack(File zipToUnbundle, String targetDir) throws IOException
zipToUnbundle - - The zip file which has to be unzippedtargetDir - - The path where the files are to be unzippedIOException - throws the IOException during file read/writepublic static File packDirectory(String sourceDir, String targetDir, String directoryName, String zipFileName, String pathRemove)
sourceDir - - The file name of the source folder whose contents
are to be zippedtargetDir - - The file name of the directory where the zip files
are to be kept on successful zip operationdirectoryName - - directoryNamezipFileName - - The name of the created zip filepathRemove - the path to be removedpublic static File packWithHash(String sourceDir, String targetDir, String filter, String zipFileName)
pack(java.lang.String, java.lang.String, java.lang.String, java.lang.String)sourceDir - - The file name of the source folder whose contents
are to be zippedtargetDir - - The file name of the directory where the zip files
are to be kept on successful zip operationfilter - - The regular expression string which is used as a filter
to zip only the required fileszipFileName - - The name of the created zip filepublic static File getHashFile(File zipFile)
zipFile - the zip File of which the hash file is requiredpublic static boolean verifyHash(File zipFile, File hashFile)
zipFile - the zip file of which hash has to be verifiedhashFile - the hash file associated with zipFileCopyright © 2014. All Rights Reserved.