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 int
packJar(Path source, Path targetJar, boolean preserveRoot)
Zip the givensource
file or folder in thetargetJar
Jar file.static int
packZip(Path source, Path targetZip, boolean preserveRoot)
Zip the givensource
file or folder in thetargetZip
Zip file.static int
unpackJar(Path source, Path outputDir)
Unzip the givensource
Jar file in theoutputDir
.static int
unpackTarGz(Path sourcePath, Path outputDir)
static int
unpackZip(Path source, Path outputDir)
Unzip the givensource
Zip file in theoutputDir
.
-
-
-
Method Detail
-
unpackZip
public static int unpackZip(Path source, Path outputDir) throws IOException
Unzip the givensource
Zip 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 givensource
Jar 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 givensource
file or folder in thetargetZip
Zip file. IfpreserveRoot
is 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 thesource
folder 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 givensource
file or folder in thetargetJar
Jar file. IfpreserveRoot
is 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 thesource
folder should be kept in the target Jar.- Returns:
- the number of packed entries
- Throws:
IOException
-
-