|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
edu.rit.classfile.DirectClassLoader
public class DirectClassLoader
Class DirectClassLoader provides a class loader into which you can directly write classfiles. To write a classfile into a DirectClassLoader:
writeClass()
method
to get an output stream for the classfile, specifying the name of the class,
and optionally specifying a protection domain for the class.
SynthesizedClassDescription
's emit()
method.
When the output stream is closed, the sequence of bytes that was written is recorded as the classfile for the given class name. Thereafter, if the DirectClassLoader is told to load a class with that name, it will use the written sequence of bytes as the classfile, and it will use the protection domain specified for the class if any.
Constructor Summary | |
---|---|
DirectClassLoader()
Construct a new direct class loader with the system class loader as the parent class loader. |
|
DirectClassLoader(ClassLoader theParent)
Construct a new direct class loader with the given class loader as the parent class loader. |
Method Summary | |
---|---|
protected Class |
findClass(String theClassName)
Finds the class with the given name in this direct class loader. |
OutputStream |
writeClass(String theClassName)
Write a class with the given name and the default protection domain into this direct class loader. |
OutputStream |
writeClass(String theClassName,
ProtectionDomain theProtectionDomain)
Write a class with the given name and the given protection domain into this direct class loader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DirectClassLoader()
SecurityException
- (unchecked exception) Thrown if there is a security manager and its
checkCreateClassLoader() method doesn't allow creation of a
new class loader.public DirectClassLoader(ClassLoader theParent)
theParent
- Parent class loader for delegation.
SecurityException
- (unchecked exception) Thrown if there is a security manager and its
checkCreateClassLoader() method doesn't allow creation of a
new class loader.Method Detail |
---|
public OutputStream writeClass(String theClassName)
theClassName
- Fully-qualified class name.
NullPointerException
- (unchecked exception) Thrown if theClassName is null.
IllegalArgumentException
- (unchecked exception) Thrown if theClassName is zero length.public OutputStream writeClass(String theClassName, ProtectionDomain theProtectionDomain)
theClassName
- Fully-qualified class name.theProtectionDomain
- Protection domain, or null to use the
default protection domain.
NullPointerException
- (unchecked exception) Thrown if theClassName is null.
IllegalArgumentException
- (unchecked exception) Thrown if theClassName is zero length.protected Class findClass(String theClassName) throws ClassNotFoundException
findClass
in class ClassLoader
theClassName
- Fully-qualified class name.
ClassNotFoundException
- Thrown if no class named theClassName has been written into
this direct class loader.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |