public class UberJarRealmClassLoader extends URLClassLoader
ClassRealms.
Loads classes from an "uberjar".| Modifier and Type | Field and Description |
|---|---|
protected DefaultClassRealm |
realm
The realm.
|
| Constructor and Description |
|---|
UberJarRealmClassLoader(DefaultClassRealm realm) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConstituent(URL constituent)
Add a constituent to this realm for locating classes.
|
protected byte[] |
findClassInDirectoryUrl(URL url,
String path) |
protected byte[] |
findClassInJarStream(URL inUrl,
String path) |
URL |
findResource(String name)
Find a resource within this ClassLoader only (don't delegate to the parent).
|
protected URL |
findResourceInDirectoryUrl(URL inUrl,
String path) |
protected URL |
findResourceInJarStream(URL inUrl,
String path) |
Enumeration |
findResources(String name) |
Enumeration |
findResourcesDirect(String name)
Find resources from this ClassLoader, and don't search the realm.
|
byte[] |
getBytesToEndOfStream(DataInputStream in)
Helper method for addConstituent that reads in a DataInputStream and returns it as a byte[]
It attempts to use in.available - the size of the file - else defaults to 2048
|
URL |
getResource(String name) |
URL |
getResourceDirect(String name)
Get a resource from this ClassLoader, and don't search the realm.
|
URL[] |
getURLs()
Retrieve the
URLs used by this ClassLoader. |
protected Class |
loadClass(String name,
boolean resolve)
Load a class.
|
Class |
loadClassDirect(String className)
Load a class directly from this classloader without
defering through any other
ClassRealm. |
addURL, close, definePackage, findClass, getPermissions, getResourceAsStream, newInstance, newInstancedefineClass, defineClassclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignersprotected DefaultClassRealm realm
public UberJarRealmClassLoader(DefaultClassRealm realm)
public void addConstituent(URL constituent)
constituent - URL to contituent jar or directory.public Class loadClassDirect(String className) throws ClassNotFoundException
ClassRealm.className - The name of the class to load.ClassNotFoundException - If the class could not be found.public URL findResource(String name)
public Enumeration findResourcesDirect(String name)
public byte[] getBytesToEndOfStream(DataInputStream in) throws IOException
IOExceptionprotected Class loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass in class ClassLoadername - The name of the class to load.resolve - If true then resolve the class.ClassNotFoundException - If the class cannot be found.public URL[] getURLs()
URLs used by this ClassLoader.getURLs in class URLClassLoaderpublic URL getResource(String name)
getResource in class ClassLoaderpublic URL getResourceDirect(String name)
public Enumeration findResources(String name) throws IOException
findResources in class URLClassLoaderIOExceptionCopyright © 2002–2017 The Codehaus. All rights reserved.