|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
org.openejb.util.MemoryClassLoader
public class MemoryClassLoader
Works around deficencies in Sun's URLClassLoader implementation. Unfortunately, the URLClassLoader doesn't like it when the original JAR file changes, and reportedly on Windows it keeps the JAR file locked too. As well, it seems that you can't make a URLClassLoader using URLs from Resources in a previous URLClassLoader. So this ClassLoader loads the contents of the JAR(s) into memory immediately and then releases the files. The classes are flushed as they are used, but other files stay in memory permanently. Note that you cannot acquire a class file as a resource (URL or stream).
Warning: URLs for this are not yet implemented! You cannot call getResource() or getResources()!
Constructor Summary | |
---|---|
MemoryClassLoader(java.lang.ClassLoader parent,
java.util.jar.JarFile file)
|
|
MemoryClassLoader(java.lang.ClassLoader parent,
java.util.jar.JarFile[] file)
|
|
MemoryClassLoader(java.lang.ClassLoader parent,
java.util.jar.JarInputStream stream)
Note that you must close the stream after the constructor returns, in case it is itself a JarInputStream or something. |
|
MemoryClassLoader(java.lang.ClassLoader parent,
java.util.jar.JarInputStream[] stream)
Note that you must close the streams after the constructor returns, in case they are also from a JarInputStream or something. |
Method Summary | |
---|---|
void |
addJar(java.util.jar.JarFile jar)
Adds a new JAR to this ClassLoader. |
void |
addJar(java.util.jar.JarInputStream stream)
Adds a new JAR to this ClassLoader. |
boolean |
equals(java.lang.Object o)
|
java.lang.Class |
findClass(java.lang.String name)
|
protected java.util.Enumeration |
findResources(java.lang.String name)
|
java.net.URL |
getResource(java.lang.String name)
|
java.io.InputStream |
getResourceAsStream(java.lang.String name)
|
int |
hashCode()
|
Methods inherited from class java.lang.ClassLoader |
---|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findSystemClass, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MemoryClassLoader(java.lang.ClassLoader parent, java.util.jar.JarFile file)
public MemoryClassLoader(java.lang.ClassLoader parent, java.util.jar.JarFile[] file)
public MemoryClassLoader(java.lang.ClassLoader parent, java.util.jar.JarInputStream stream)
public MemoryClassLoader(java.lang.ClassLoader parent, java.util.jar.JarInputStream[] stream)
Method Detail |
---|
public java.io.InputStream getResourceAsStream(java.lang.String name)
getResourceAsStream
in class java.lang.ClassLoader
public java.net.URL getResource(java.lang.String name)
getResource
in class java.lang.ClassLoader
protected java.util.Enumeration findResources(java.lang.String name) throws java.io.IOException
findResources
in class java.lang.ClassLoader
java.io.IOException
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Class findClass(java.lang.String name) throws java.lang.ClassNotFoundException
findClass
in class java.lang.ClassLoader
java.lang.ClassNotFoundException
public void addJar(java.util.jar.JarFile jar)
public void addJar(java.util.jar.JarInputStream stream)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |