public class mClassLoader extends ClassLoader
Modifier and Type | Field and Description |
---|---|
FileStore |
fileStore
If you set this to a non-null FileStore, then the default behavior of the
mClass loader is to try to load all classes from this FileStore.
|
protected Hashtable |
loaded
A cache of already loaded classes.
|
File |
sourceDirectory
If you set this to a directory File, then the default behavior of the
mClass loader is to try to load all classes from this File.
|
Constructor and Description |
---|
mClassLoader() |
Modifier and Type | Method and Description |
---|---|
static void |
addClassLoader(ClassLoader loader)
Add a ClassLoader to the WeakSet of application classLoaders.
|
void |
authorize(mClassLoader other)
This passes authority from this ClassLoader to another.
|
protected void |
cacheClass(String className,
Class aClass)
Override this to provide class caching.
|
protected Class |
findCachedClass(String className)
Override this to provide class caching.
|
protected ByteArray |
findClassBytes(String className)
You can override this method OR you can override getInputStreamFor(String className) - which is called
by this method.
|
static int |
getClassLoaders(Vector dest)
Get the current set of application ClassLoaders into a Vector, or simply count the number
of active ClassLoaders.
|
static int |
getClassLoaders(Vector dest,
boolean quick)
Get the current set of application ClassLoaders into a Vector, or simply count the number
of active ClassLoaders.
|
protected InputStream |
getInputStreamFor(String className)
This is called by findClassBytes by default and you can override this if necessary instead of overriding
findClassBytes().
|
protected Class |
loadClass(String className,
boolean resolve)
This method will check for system classes and cached classes before calling
findClassBytes().
|
static InputStream |
loadResourceFromAll(String resourceName) |
InputStream |
openResource(String resourceName)
This is used to get a resource which may be dependant on the how the class
was loaded.
|
static void |
removeClassLoader(ClassLoader loader)
Remove a ClassLoader from the WeakSet of application classLoaders.
|
defineClass, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass
public File sourceDirectory
public FileStore fileStore
protected Hashtable loaded
public final void authorize(mClassLoader other) throws SecurityException
SecurityException
public static void addClassLoader(ClassLoader loader)
public static void removeClassLoader(ClassLoader loader)
public static int getClassLoaders(Vector dest)
dest
- A Vector to hold the class loaders. If this is not null it will be cleared before
the classes are placed in it. If it is null then this just counts the number of active ClassLoaders.public static int getClassLoaders(Vector dest, boolean quick)
dest
- A Vector to hold the class loaders. If this is not null it will be cleared before
the classes are placed in it. If it is null then this just counts the number of active ClassLoaders.quick
- if this is true then the references are moved from the WeakSet directly
to the destination vector without editing out the possible null references. If
quick is false then the Vector will contain only non-null references.protected Class loadClass(String className, boolean resolve) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
protected Class findCachedClass(String className)
protected void cacheClass(String className, Class aClass)
protected ByteArray findClassBytes(String className)
protected InputStream getInputStreamFor(String className)
public InputStream openResource(String resourceName)
public static InputStream loadResourceFromAll(String resourceName)