|
|||||||||||
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
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(ClassLoader parent,
JarFile file)
|
|
MemoryClassLoader(ClassLoader parent,
JarFile[] file)
|
|
MemoryClassLoader(ClassLoader parent,
JarInputStream stream)
Note that you must close the stream after the constructor returns, in case it is itself a JarInputStream or something. |
|
MemoryClassLoader(ClassLoader parent,
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(JarFile jar)
Adds a new JAR to this ClassLoader. |
void |
addJar(JarInputStream stream)
Adds a new JAR to this ClassLoader. |
boolean |
equals(Object o)
|
Class |
findClass(String name)
|
protected Enumeration |
findResources(String name)
|
URL |
getResource(String name)
|
InputStream |
getResourceAsStream(String name)
|
int |
hashCode()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MemoryClassLoader(ClassLoader parent, JarFile file)
public MemoryClassLoader(ClassLoader parent, JarFile[] file)
public MemoryClassLoader(ClassLoader parent, JarInputStream stream)
public MemoryClassLoader(ClassLoader parent, JarInputStream[] stream)
Method Detail |
public InputStream getResourceAsStream(String name)
public URL getResource(String name)
protected Enumeration findResources(String name) throws IOException
IOException
public boolean equals(Object o)
public int hashCode()
public Class findClass(String name) throws ClassNotFoundException
ClassNotFoundException
public void addJar(JarFile jar)
public void addJar(JarInputStream stream)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |