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.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionByteArrayClassLoader(Map<String, byte[]> classes) The givenMapof classes must not be modified afterwards.ByteArrayClassLoader(Map<String, byte[]> classes, ClassLoader parent) -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<?> ImplementsClassLoader.findClass(String).getResourceAsStream(String name) voidsetResources(Map<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
-
Field Details
-
classes
-
resources
-
-
Constructor Details
-
ByteArrayClassLoader
The givenMapof classes must not be modified afterwards.- Parameters:
classes- String className => byte[] data, or String classFileName => byte[] data
-
ByteArrayClassLoader
- Parameters:
classes-String className=>byte[] data, orString classFileName=>byte[] data
-
-
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
-