Class ByteArrayClassLoader
java.lang.Object
java.lang.ClassLoader
org.codehaus.commons.compiler.util.reflect.ByteArrayClassLoader
This
ClassLoader allows for the loading of a set of Java classes provided in class file format.-
Constructor Summary
ConstructorsConstructorDescriptionByteArrayClassLoader(Map<String, byte[]> classes) The givenMapof classes must not be modified afterwards.ByteArrayClassLoader(Map<String, byte[]> classes, ClassLoader parent) ByteArrayClassLoader(Map<String, byte[]> classes, ClassLoader parent, ProtectionDomain protectionDomain) -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<?> ImplementsClassLoader.findClass(String).getResourceAsStream(String name) voidsetResources(Map<String, byte[]> resources) Methods inherited from class ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
ByteArrayClassLoader
-
ByteArrayClassLoader
- Parameters:
classes-String className=>byte[] data, orString classFileName=>byte[] data
-
ByteArrayClassLoader
public ByteArrayClassLoader(Map<String, byte[]> classes, ClassLoader parent, @Nullable ProtectionDomain protectionDomain) - Parameters:
classes-String className=>byte[] data, orString classFileName=>byte[] dataprotectionDomain- The protection domain with which the classes are defined;nullmeans the protection domain of this class (which is the default)
-
-
Method Details
-
setResources
-
findClass
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:
findClassin classClassLoader- Throws:
ClassNotFoundException
-
getResourceAsStream
- Overrides:
getResourceAsStreamin classClassLoader
-