Package gov.nih.mipav.plugins
Class JarClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- gov.nih.mipav.plugins.JarClassLoader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class JarClassLoader extends java.net.URLClassLoader
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.String,java.lang.Class>
cachedClass
private java.net.URLClassLoader
internalClassLoader
-
Constructor Summary
Constructors Constructor Description JarClassLoader(java.lang.ClassLoader c)
JarClassLoader(java.net.URL[] urls)
JarClassLoader(java.net.URL[] arg0, java.lang.ClassLoader arg1)
JarClassLoader(java.net.URL[] arg0, java.lang.ClassLoader arg1, java.net.URLStreamHandlerFactory arg2)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addJarContext(java.lang.String context)
void
clearAllContexts()
private java.net.URL
contextStringToURL(java.lang.String context)
protected java.lang.Class<?>
findClass(java.lang.String name)
java.net.URL
findResource(java.lang.String name)
java.util.Enumeration<java.net.URL>
findResources(java.lang.String name)
java.net.URL
getResource(java.lang.String name)
java.io.InputStream
getResourceAsStream(java.lang.String name)
java.util.Enumeration<java.net.URL>
getResources(java.lang.String name)
java.net.URL[]
getURLs()
private void
init(java.net.URL[] arg0, java.lang.ClassLoader arg1, java.net.URLStreamHandlerFactory arg2)
boolean
isContext(java.lang.String context)
java.lang.Class<?>
loadClass(java.lang.String name)
protected java.lang.Class<?>
loadClass(java.lang.String className, boolean resolveIt)
static java.net.URLClassLoader
newInstance(java.net.URL[] arg0)
boolean
removeJarContext(java.lang.String context)
-
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, getPermissions, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Constructor Detail
-
JarClassLoader
public JarClassLoader(java.lang.ClassLoader c) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
JarClassLoader
public JarClassLoader(java.net.URL[] urls)
-
JarClassLoader
public JarClassLoader(java.net.URL[] arg0, java.lang.ClassLoader arg1, java.net.URLStreamHandlerFactory arg2)
-
JarClassLoader
public JarClassLoader(java.net.URL[] arg0, java.lang.ClassLoader arg1)
-
-
Method Detail
-
init
private void init(java.net.URL[] arg0, java.lang.ClassLoader arg1, java.net.URLStreamHandlerFactory arg2)
-
addJarContext
public boolean addJarContext(java.lang.String context) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
removeJarContext
public boolean removeJarContext(java.lang.String context)
-
contextStringToURL
private java.net.URL contextStringToURL(java.lang.String context)
-
clearAllContexts
public void clearAllContexts()
-
isContext
public boolean isContext(java.lang.String context) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
getResource
public java.net.URL getResource(java.lang.String name)
- Overrides:
getResource
in classjava.lang.ClassLoader
-
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String name)
- Overrides:
getResourceAsStream
in classjava.net.URLClassLoader
-
getResources
public java.util.Enumeration<java.net.URL> getResources(java.lang.String name) throws java.io.IOException
- Overrides:
getResources
in classjava.lang.ClassLoader
- Throws:
java.io.IOException
-
loadClass
protected java.lang.Class<?> loadClass(java.lang.String className, boolean resolveIt) throws java.lang.ClassNotFoundException
- Overrides:
loadClass
in classjava.lang.ClassLoader
- Throws:
java.lang.ClassNotFoundException
-
loadClass
public java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
- Overrides:
loadClass
in classjava.lang.ClassLoader
- Throws:
java.lang.ClassNotFoundException
-
findClass
protected java.lang.Class<?> findClass(java.lang.String name) throws java.lang.ClassNotFoundException
- Overrides:
findClass
in classjava.net.URLClassLoader
- Throws:
java.lang.ClassNotFoundException
-
findResource
public java.net.URL findResource(java.lang.String name)
- Overrides:
findResource
in classjava.net.URLClassLoader
-
findResources
public java.util.Enumeration<java.net.URL> findResources(java.lang.String name) throws java.io.IOException
- Overrides:
findResources
in classjava.net.URLClassLoader
- Throws:
java.io.IOException
-
getURLs
public java.net.URL[] getURLs()
- Overrides:
getURLs
in classjava.net.URLClassLoader
-
newInstance
public static java.net.URLClassLoader newInstance(java.net.URL[] arg0)
-
-