Class ByteArrayClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- org.codehaus.commons.compiler.util.reflect.ByteArrayClassLoader
-
public class ByteArrayClassLoader extends java.lang.ClassLoader
ThisClassLoader
allows for the loading of a set of Java classes provided in class file format.
-
-
Constructor Summary
Constructors Constructor Description ByteArrayClassLoader(java.util.Map<java.lang.String,byte[]> classes)
The givenMap
of classes must not be modified afterwards.ByteArrayClassLoader(java.util.Map<java.lang.String,byte[]> classes, java.lang.ClassLoader parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Class<?>
findClass(java.lang.String name)
ImplementsClassLoader.findClass(String)
.java.io.InputStream
getResourceAsStream(java.lang.String name)
void
setResources(java.util.Map<java.lang.String,byte[]> resources)
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Constructor Detail
-
ByteArrayClassLoader
public ByteArrayClassLoader(java.util.Map<java.lang.String,byte[]> classes)
The givenMap
of classes must not be modified afterwards.- Parameters:
classes
- String className => byte[] data, or String classFileName => byte[] data
-
ByteArrayClassLoader
public ByteArrayClassLoader(java.util.Map<java.lang.String,byte[]> classes, java.lang.ClassLoader parent)
- Parameters:
classes
-String className
=>byte[] data
, orString classFileName
=>byte[] data
-
-
Method Detail
-
setResources
public void setResources(java.util.Map<java.lang.String,byte[]> resources)
-
findClass
protected java.lang.Class<?> findClass(@Nullable java.lang.String name) throws java.lang.ClassNotFoundException
ImplementsClassLoader.findClass(String)
.Notice that, although nowhere documented, no more than one thread at a time calls this method, because
ClassLoader.loadClass(java.lang.String)
issynchronized
.- Overrides:
findClass
in classjava.lang.ClassLoader
- Throws:
java.lang.ClassNotFoundException
-
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String name)
- Overrides:
getResourceAsStream
in classjava.lang.ClassLoader
-
-