Package org.eclipse.cbi.common.util
Class Zips
- java.lang.Object
-
- org.eclipse.cbi.common.util.Zips
-
-
Constructor Summary
Constructors Constructor Description Zips()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intpackJar(Path source, Path targetJar, boolean preserveRoot)Zip the givensourcefile or folder in thetargetJarJar file.static intpackZip(Path source, Path targetZip, boolean preserveRoot)Zip the givensourcefile or folder in thetargetZipZip file.static intunpackJar(Path source, Path outputDir)Unzip the givensourceJar file in theoutputDir.static intunpackTarGz(Path sourcePath, Path outputDir)static intunpackZip(Path source, Path outputDir)Unzip the givensourceZip file in theoutputDir.
-
-
-
Method Detail
-
unpackZip
public static int unpackZip(Path source, Path outputDir) throws IOException
Unzip the givensourceZip file in theoutputDir.- Parameters:
source- the file to unzip.outputDir- the output directory where the Zip will be unpacked.- Returns:
- the number of unpacked entries
- Throws:
IOException
-
unpackJar
public static int unpackJar(Path source, Path outputDir) throws IOException
Unzip the givensourceJar file in theoutputDir.- Parameters:
source- the file to unzip.outputDir- the output directory where the Jar will be unpacked. It does not have to exist beforehand.- Returns:
- the number of unpacked entries
- Throws:
IOException
-
unpackTarGz
public static int unpackTarGz(Path sourcePath, Path outputDir) throws IOException
- Throws:
IOException
-
packZip
public static int packZip(Path source, Path targetZip, boolean preserveRoot) throws IOException
Zip the givensourcefile or folder in thetargetZipZip file. IfpreserveRootis set to true, the output Zip will contain the folder and its contents, only its contents otherwise.- Parameters:
source- the folder to zip.targetZip- the Zip file to create or overwrite.preserveRoot- whether thesourcefolder should be kept in the target Zip.- Returns:
- the number of packed entries
- Throws:
IOException
-
packJar
public static int packJar(Path source, Path targetJar, boolean preserveRoot) throws IOException
Zip the givensourcefile or folder in thetargetJarJar file. IfpreserveRootis set to true, the output Zip will contain the folder and its contents, only its contents otherwise.- Parameters:
source- the folder to zip.targetJar- the Jar file to create or overwrite.preserveRoot- whether thesourcefolder should be kept in the target Jar.- Returns:
- the number of packed entries
- Throws:
IOException
-
-