public final class JarUtils extends Object
Modifier and Type | Method and Description |
---|---|
static URL |
extractNestedJar(URL jarURL,
File dest)
Given a URL check if its a jar url(jar:
|
static void |
jar(OutputStream out,
File src)
This function will create a Jar archive containing the src
file/directory.
|
static void |
jar(OutputStream out,
File[] src)
This function will create a Jar archive containing the src
file/directory.
|
static void |
jar(OutputStream out,
File[] src,
FileFilter filter)
This function will create a Jar archive containing the src
file/directory.
|
static void |
jar(OutputStream out,
File[] src,
FileFilter filter,
String prefix,
Manifest man)
This function will create a Jar archive containing the src
file/directory.
|
static void |
main(String[] args) |
static void |
unjar(InputStream in,
File dest) |
public static void jar(OutputStream out, File src) throws IOException
This function will create a Jar archive containing the src file/directory. The archive will be written to the specified OutputStream.
This is a shortcut for
jar(out, new File[] { src }, null, null, null);
out
- The output stream to which the generated Jar archive is
written.src
- The file or directory to jar up. Directories will be
processed recursively.IOException
public static void jar(OutputStream out, File[] src) throws IOException
This function will create a Jar archive containing the src file/directory. The archive will be written to the specified OutputStream.
This is a shortcut for
jar(out, src, null, null, null);
out
- The output stream to which the generated Jar archive is
written.src
- The file or directory to jar up. Directories will be
processed recursively.IOException
public static void jar(OutputStream out, File[] src, FileFilter filter) throws IOException
This function will create a Jar archive containing the src file/directory. The archive will be written to the specified OutputStream. Directories are processed recursively, applying the specified filter if it exists.
This is a shortcut for
jar(out, src, filter, null, null);
out
- The output stream to which the generated Jar archive is
written.src
- The file or directory to jar up. Directories will be
processed recursively.filter
- The filter to use while processing directories. Only
those files matching will be included in the jar archive. If
null, then all files are included.IOException
public static void jar(OutputStream out, File[] src, FileFilter filter, String prefix, Manifest man) throws IOException
This function will create a Jar archive containing the src file/directory. The archive will be written to the specified OutputStream. Directories are processed recursively, applying the specified filter if it exists.
out
- The output stream to which the generated Jar archive is
written.src
- The file or directory to jar up. Directories will be
processed recursively.filter
- The filter to use while processing directories. Only
those files matching will be included in the jar archive. If
null, then all files are included.prefix
- The name of an arbitrary directory that will precede all
entries in the jar archive. If null, then no prefix will be
used.man
- The manifest to use for the Jar archive. If null, then no
manifest will be included.IOException
public static void unjar(InputStream in, File dest) throws IOException
IOException
public static URL extractNestedJar(URL jarURL, File dest) throws IOException
jarURL
- the URL to validate and extract the referenced entry if its
a jar protocol URLdest
- the directory into which the nested jar will be extracted.IOException
Copyright © 2018 JBoss by Red Hat. All rights reserved.