public class ClasspathUrlExtender
extends java.lang.Object
buildURL(URL, String)
method must be used to
construct a URL for a resource on the classpath, and the setClassLoader(ClassLoader)
method must first be
used to set the classloader if it differs from the classloader used for loading this class.Modifier and Type | Class | Description |
---|---|---|
static class |
ClasspathUrlExtender.ClasspathHandler |
Handler for opening a connection to a resource from the classpath.
|
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
CLASSPATH_PROTOCOL |
Protocol name for classpath access.
|
private static ClasspathUrlExtender.ClasspathHandler |
s_handler |
Singleton instance of handler for stream access to resource.
|
Constructor | Description |
---|---|
ClasspathUrlExtender() |
Modifier and Type | Method | Description |
---|---|---|
static java.net.URL |
buildURL(java.net.URL base,
java.lang.String path) |
Construct a URL which may represent a resource from the classpath.
|
static boolean |
isClasspathUrl(java.lang.String url) |
Check if a URL string represents a resource from the classpath.
|
static void |
setClassLoader(java.lang.ClassLoader loader) |
Set the classloader to be used for accessing resources.
|
public static final java.lang.String CLASSPATH_PROTOCOL
private static ClasspathUrlExtender.ClasspathHandler s_handler
public static void setClassLoader(java.lang.ClassLoader loader)
loader
- public static boolean isClasspathUrl(java.lang.String url)
url
- true
if classpath resource, false
if notpublic static java.net.URL buildURL(java.net.URL base, java.lang.String path) throws java.net.MalformedURLException
base
- URL base for relative referencespath
- resource pathjava.net.MalformedURLException
- if not a valid URL format