@PublicAPI public class JarUtils extends ZipUtils
COMP_LEVEL
Constructor and Description |
---|
JarUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
jar(String[] directoriesAndFiles,
File dest,
String manifestVerion,
String mainClass,
String jarInternalClasspath,
CRC32 crc)
Create a jar file that contains all the directory listed in directories parameter and
store the create content in a file denoted by the path in the given dest argument
|
static byte[] |
jarDirectoriesAndFiles(String[] directoriesAndFiles,
String manifestVerion,
String mainClass,
String jarInternalClasspath,
CRC32 crc)
Create a jar file that contains all the directory listed in directories parameter.
|
protected static void |
jarIt(ZipOutputStream zos,
String[] directoriesAndFiles,
CRC32 crc)
Jar directory content in the given output stream
|
static void |
unjar(JarFile jarFile,
File dest)
Unjar a jar file into a directory.
|
createFileWithPath, unzip, zip, zipDirectoriesAndFiles, zipDirectory, zipFile, zipIt
createTempDirectory, deleteRecursively, getExtension, getFileNameWithExtension, removeDir, resolvePropertiesFile
public static byte[] jarDirectoriesAndFiles(String[] directoriesAndFiles, String manifestVerion, String mainClass, String jarInternalClasspath, CRC32 crc) throws IOException
directoriesAndFiles
- the list of directories and files to be jarred.manifestVerion
- the version of the jar manifest (can be null).mainClass
- the main class of the jar (can be null).jarInternalClasspath
- the class-path of the jar (can be null).crc
- the CRC32 of all jar entries. Can be null if no crc is needed.IOException
- if the jar file cannot be created.protected static void jarIt(ZipOutputStream zos, String[] directoriesAndFiles, CRC32 crc) throws IOException
zos
- the output stream in which to store the jarred directorydirectoriesAndFiles
- a list of directories and files to be jarredIOException
- if a jar entry cannot be created.public static void jar(String[] directoriesAndFiles, File dest, String manifestVerion, String mainClass, String jarInternalClasspath, CRC32 crc) throws IOException
directoriesAndFiles
- the directories and files to jar (recursively)dest
- the jar destination file that will contains the jarred version of the first argument.manifestVerion
- the version of the jar manifest (can be null).mainClass
- the main class of the jar (can be null).jarInternalClasspath
- the class-path of the jar (can be null).crc
- the CRC32 of all ajr entries. Can be null if no crc is needed.IOException
- if the zip file cannot be created.public static void unjar(JarFile jarFile, File dest) throws IOException
jarFile
- The jar file to be unjared.dest
- the destination directory.IOException
- if the destination does not exist or is not a directory, or if the jar file cannot be extracted.