|
qflib 0.99 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
de.qfs.lib.util.ArchiveClassLoader
An ArchiveClassLoader loads classes from a single source, a ZipFile or a directory. Referenced classes will be loaded from the source, if possible, or loaded via the system ClassLoader otherwise.
Field Summary | |
protected java.util.Hashtable |
classes
Cache for loaded classes. |
protected java.io.File |
dir
The directory holding the classes. |
protected java.util.zip.ZipFile |
zip
The ZipFile holding the classes. |
Constructor Summary | |
ArchiveClassLoader(java.io.File dir)
Create a new ArchiveClassLoader that loads classes from a directory. |
|
ArchiveClassLoader(java.util.zip.ZipFile zip)
Create a new ArchiveClassLoader that loads classes from a ZipFile. |
Method Summary | |
java.io.InputStream |
getResourceAsStream(java.lang.String name)
Find a resource in the classpath and open a stream for it. |
java.lang.Class |
loadClass(java.lang.String name)
Load and resolve a class. |
protected java.lang.Class |
loadClass(java.lang.String name,
boolean resolve)
Load a class and maybe resolve it. |
java.lang.Class |
loadSystemClass(java.lang.String name)
Load and resolve a class via the default class loader. |
protected java.lang.Class |
makeSystemClass(java.lang.String name,
boolean resolve)
Get a system class and maybe resolve it. |
void |
restrict(java.lang.String pkg)
Add a package restriction to the class loader. |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Hashtable classes
protected java.util.zip.ZipFile zip
protected java.io.File dir
Constructor Detail |
public ArchiveClassLoader(java.util.zip.ZipFile zip)
zip
- The ZipFile to read the classes from.public ArchiveClassLoader(java.io.File dir)
dir
- The directory to read the classes from.Method Detail |
public void restrict(java.lang.String pkg)
pkg
- The package to restrict to. If the package ends in a
'.', sub-packages are included.public java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
name
- The class' name.
java.lang.ClassNotFoundException
- If no such class exists or some
IO problem occurs.public java.lang.Class loadSystemClass(java.lang.String name) throws java.lang.ClassNotFoundException
name
- The class' name.
java.lang.ClassNotFoundException
- If no such class exists or some
IO problem occurs.public java.io.InputStream getResourceAsStream(java.lang.String name)
name
- The name of the resource.
protected java.lang.Class loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
name
- The class' name.resolve
- Whether to resolve the class.
java.lang.ClassNotFoundException
- If no such class exists or some
IO problem occurs.protected java.lang.Class makeSystemClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
name
- The class' name.resolve
- Whether to resolve the class.
java.lang.ClassNotFoundException
- If no such class exists or some
IO problem occurs.
|
qflib 0.99 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |