|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.planets_project.services.utils.ZipUtils
public class ZipUtils
Constructor Summary | |
---|---|
ZipUtils()
|
Method Summary | |
---|---|
static List<File> |
checkAndUnzipTo(File zipFile,
File destFolder,
Checksum checksum)
Unzips a zip file and writes the content to destFolder, checking if the checksum is correct. |
static File |
createZip(File srcFolder,
File destFolder,
String zipName,
boolean compress)
Creates a Zip64File zip file. |
static ZipResult |
createZipAndCheck(File srcFolder,
File destFolder,
String zipName,
boolean compress)
Creates a Zip64File containing all the files in srcFolder and write it to destFolder using the passed zipName. |
static String[] |
getAllFragments(File zip)
A convenience method. |
static File |
getFileFrom(File zip,
String targetPathInZipfile,
File destFolder)
Extracts a file specified by targetPathInZipfile from the passed zip and writes it to destFolder. |
static File |
insertFileInto(File zipFile,
File toInsert,
String targetPath)
Inserts a file into a given zip at a location specified by targetPath. |
static boolean |
isZipFile(File file)
|
static List<String> |
listZipEntries(File zip)
Lists all entries in this zip file. |
static File |
removeFileFrom(File zipFile,
String fileToRemove)
Removes the file 'fileToRemove' from zipFile. |
static List<File> |
unzipTo(File zipFile,
File destFolder)
Unzips a zip file and writes the contained files to destFolder. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ZipUtils()
Method Detail |
---|
public static File createZip(File srcFolder, File destFolder, String zipName, boolean compress)
srcFolder
- the folder containing the files to be written to the zipdestFolder
- the folder to write the Zip file tozipName
- the name the zip file should have. If no zipName is passed, the name of the folder will be used.compress
- true if the file shoukld be compressed, false if not.
public static ZipResult createZipAndCheck(File srcFolder, File destFolder, String zipName, boolean compress)
srcFolder
- the folder containing the files to be written to the zipdestFolder
- the folder to write the Zip file tozipName
- the name the zip file should have. If no zipName is passed, the name of the folder will be used.compress
- has no effect TODO implement compression
public static List<File> unzipTo(File zipFile, File destFolder)
zipFile
- the zip file to unpack.destFolder
- the folder to write the extracted files to.
public static List<File> checkAndUnzipTo(File zipFile, File destFolder, Checksum checksum)
zipFile
- the file to unpackdestFolder
- the folder to write the content of the zip tochecksum
- the checksum to check
public static String[] getAllFragments(File zip)
zip
- the zip file to scan
public static File getFileFrom(File zip, String targetPathInZipfile, File destFolder)
zip
- the zip to extract targetPathInZipfile fromtargetPathInZipfile
- the file to extractdestFolder
- the folder to write the extrcated file to
public static File insertFileInto(File zipFile, File toInsert, String targetPath)
zipFile
- the zip file where the file toInsert will be added.toInsert
- the file to add to the ziptargetPath
- the location the file should have in this zip
public static File removeFileFrom(File zipFile, String fileToRemove)
zipFile
- the zip file to remove fileToRemove from.fileToRemove
- the path of the file to remove from zipFile.
public static boolean isZipFile(File file)
public static List<String> listZipEntries(File zip)
zip
- the zip file to scan
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |