public class JarUtils
extends java.lang.Object
| Constructor and Description |
|---|
JarUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isJarURI(java.net.URI uri)
Returns whether the given
uri is a Jar URI as returned, e.g., by a classloader. |
static boolean |
isJarURL(java.net.URL url)
Returns whether the given
url is a JAR URL as returned, e.g., by a classloader. |
static void |
unpackJar(java.net.URL url,
java.io.File target)
Unpacks a Jar file denoted by
url to the given target folder. |
static void |
unpackJar(java.net.URL url,
java.lang.String resource,
java.io.File target)
Unpacks a Jar file denoted by
url to the given target folder. |
public static boolean isJarURI(java.net.URI uri)
uri is a Jar URI as returned, e.g., by a classloader.uri - the URI (ignored if null)true for a Jar URI, false elsepublic static boolean isJarURL(java.net.URL url)
url is a JAR URL as returned, e.g., by a classloader.url - the URL (ignored if null)true for a JAR URL, false elsepublic static void unpackJar(java.net.URL url,
java.io.File target)
throws java.net.MalformedURLException,
java.io.IOException
url to the given target folder. target
may not exist and is created then. Existing files are overwritten.url - the Jar URLtarget - the target folderjava.net.MalformedURLException - in case that the URL is ill formed or not a Jar URLjava.io.IOException - in case of any I/O problemspublic static void unpackJar(java.net.URL url,
java.lang.String resource,
java.io.File target)
throws java.io.IOException
url to the given target folder. target
may not exist and is created then. Existing files are overwritten.url - the Jar URLresource - a resource within the JAR to extract, may be a file or a folder in JAR format specification,
i.e., without leading / but trailing /target - the target folderjava.net.MalformedURLException - in case that the URL is ill formed or not a Jar URLjava.io.IOException - in case of any I/O problemsCopyright © 2009 - 2018 SSE. All Rights Reserved.