Class UberJarRealmClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.codehaus.classworlds.RealmClassLoader
org.codehaus.classworlds.UberJarRealmClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable
Classloader for
ClassRealms.
Loads classes from an "uberjar".- Version:
- $Id: UberJarRealmClassLoader.java 126 2006-01-12 04:17:51Z $
- Author:
- bob mcwhirter
-
Field Summary
FieldsFields inherited from class org.codehaus.classworlds.RealmClassLoader
realm -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConstituent(URL constituent) Add a constituent to this realm for locating classes.private voidbuildIndexForJar(URL inUrl) protected byte[]findClassInDirectoryUrl(URL url, String path) protected byte[]findClassInJarStream(URL inUrl, String path) findResource(String name) Find a resource within this ClassLoader only (don't delegate to the parent).protected URLfindResourceInDirectoryUrl(URL inUrl, String path) protected URLfindResourceInJarStream(URL inUrl, String path) findResourcesDirect(String name) Find resources from this ClassLoader, and don't search the realm.loadClassDirect(String className) Load a class directly from this classloader without defering through any otherClassRealm.private byte[]Methods inherited from class org.codehaus.classworlds.RealmClassLoader
findResources, getBytesToEndOfStream, getRealm, getResource, getResourceDirect, getURLs, loadClassMethods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, getPermissions, getResourceAsStream, newInstance, newInstanceMethods inherited from class java.security.SecureClassLoader
defineClass, defineClassMethods 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, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
classIndex
-
urls
-
jarIndexes
-
-
Constructor Details
-
UberJarRealmClassLoader
-
-
Method Details
-
addConstituent
Description copied from class:RealmClassLoaderAdd a constituent to this realm for locating classes. If the url definition ends in .class its a BytesURLStreamHandler so use defineClass insead. addURL is still called for byte[] even though it has no affect and we use defineClass instead, this is for consistentency and to allow access to the class with getURLs()- Overrides:
addConstituentin classRealmClassLoader- Parameters:
constituent- URL to contituent jar or directory.
-
buildIndexForJar
-
loadClassDirect
Load a class directly from this classloader without defering through any otherClassRealm.- Overrides:
loadClassDirectin classRealmClassLoader- Parameters:
className- The name of the class to load.- Returns:
- The loaded class.
- Throws:
ClassNotFoundException- If the class could not be found.
-
findResource
Description copied from class:RealmClassLoaderFind a resource within this ClassLoader only (don't delegate to the parent).- Overrides:
findResourcein classRealmClassLoader- Returns:
- The resource.
-
findResourcesDirect
Description copied from class:RealmClassLoaderFind resources from this ClassLoader, and don't search the realm. Otherwise we'd recurse indefinitely.- Overrides:
findResourcesDirectin classRealmClassLoader- Returns:
- The resource.
-
findResourceInJarStream
-
findResourceInDirectoryUrl
-
findClassInJarStream
-
findClassInDirectoryUrl
-
readStream
- Throws:
IOException
-