public class ByteArrayClassLoader extends ClassLoader
 A ClassLoader that is capable of loading explicitly defined classes. The class loader will free
 any binary resources once a class that is defined by its binary data is loaded. This class loader is thread safe since
 the class loading mechanics are only called from synchronized context.
 
Note: Instances of this class loader return URLs for their represented class loaders with the bytebuddy schema. These URLs do not represent URIs as two classes with the same name yield identical URLs but might represents different byte arrays.
| Modifier and Type | Class and Description | 
|---|---|
| static class  | ByteArrayClassLoader.ChildFirst
 A  ByteArrayClassLoaderwhich applies child-first semantics for the
 given type definitions. | 
| protected static class  | ByteArrayClassLoader.ClassLoaderCreationActionAn action for creating a class loader. | 
| protected static class  | ByteArrayClassLoader.EmptyEnumerationAn enumeration without any elements. | 
| static class  | ByteArrayClassLoader.PersistenceHandlerA persistence handler decides on weather the byte array that represents a loaded class is exposed by
 the  ClassLoader.getResourceAsStream(String)method. | 
| protected static class  | ByteArrayClassLoader.SingletonEnumerationAn enumeration that contains a single element. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected AccessControlContext | accessControlContextThe access control context to use for loading classes. | 
| protected PackageDefinitionStrategy | packageDefinitionStrategyThe package definer to be queried for package definitions. | 
| protected ByteArrayClassLoader.PersistenceHandler | persistenceHandlerThe persistence handler of this class loader. | 
| protected ProtectionDomain | protectionDomainThe protection domain to apply. | 
| protected Map<String,byte[]> | typeDefinitionsA mutable map of type names mapped to their binary representation. | 
| static String | URL_SCHEMAThe schema for URLs that represent a class file of byte array class loaders. | 
| Constructor and Description | 
|---|
| ByteArrayClassLoader(ClassLoader parent,
                    Map<String,byte[]> typeDefinitions,
                    ProtectionDomain protectionDomain,
                    AccessControlContext accessControlContext,
                    ByteArrayClassLoader.PersistenceHandler persistenceHandler,
                    PackageDefinitionStrategy packageDefinitionStrategy)Creates a new class loader for a given definition of classes. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected Class<?> | findClass(String name) | 
| protected URL | findResource(String name) | 
| protected Enumeration<URL> | findResources(String name) | 
| static Map<TypeDescription,Class<?>> | load(ClassLoader classLoader,
    Map<TypeDescription,byte[]> types,
    ProtectionDomain protectionDomain,
    AccessControlContext accessControlContext,
    ByteArrayClassLoader.PersistenceHandler persistenceHandler,
    PackageDefinitionStrategy packageDefinitionStrategy,
    boolean childFirst,
    boolean forbidExisting)Loads a given set of class descriptions and their binary representations. | 
| static ClassLoader | of(ClassLoader parent,
  Map<TypeDescription,byte[]> typeDefinitions,
  ProtectionDomain protectionDomain,
  AccessControlContext accessControlContext,
  ByteArrayClassLoader.PersistenceHandler persistenceHandler,
  PackageDefinitionStrategy packageDefinitionStrategy,
  boolean childFirst)Creates a new class loader for a given definition of classes. | 
| String | toString() | 
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic static final String URL_SCHEMA
protected final Map<String,byte[]> typeDefinitions
protected final ByteArrayClassLoader.PersistenceHandler persistenceHandler
protected final ProtectionDomain protectionDomain
null when referencing the default protection domain.protected final PackageDefinitionStrategy packageDefinitionStrategy
protected final AccessControlContext accessControlContext
public ByteArrayClassLoader(ClassLoader parent, Map<String,byte[]> typeDefinitions, ProtectionDomain protectionDomain, AccessControlContext accessControlContext, ByteArrayClassLoader.PersistenceHandler persistenceHandler, PackageDefinitionStrategy packageDefinitionStrategy)
parent - The ClassLoader that is the parent of this class loader.typeDefinitions - A map of fully qualified class names pointing to their binary representations.protectionDomain - The protection domain to apply where null references an implicit protection domain.accessControlContext - The access control context to use for loading classes.packageDefinitionStrategy - The package definer to be queried for package definitions.persistenceHandler - The persistence handler of this class loader.public static ClassLoader of(ClassLoader parent, Map<TypeDescription,byte[]> typeDefinitions, ProtectionDomain protectionDomain, AccessControlContext accessControlContext, ByteArrayClassLoader.PersistenceHandler persistenceHandler, PackageDefinitionStrategy packageDefinitionStrategy, boolean childFirst)
parent - The ClassLoader that is the parent of this class loader.typeDefinitions - A map of type descriptions pointing to their binary representations.protectionDomain - The protection domain to apply where null references an implicit protection domain.accessControlContext - The access control context to use for loading classes.persistenceHandler - The persistence handler to be used by the created class loader.packageDefinitionStrategy - The package definer to be queried for package definitions.childFirst - true if the class loader should apply child first semantics when loading
                                  the typeDefinitions.public static Map<TypeDescription,Class<?>> load(ClassLoader classLoader, Map<TypeDescription,byte[]> types, ProtectionDomain protectionDomain, AccessControlContext accessControlContext, ByteArrayClassLoader.PersistenceHandler persistenceHandler, PackageDefinitionStrategy packageDefinitionStrategy, boolean childFirst, boolean forbidExisting)
classLoader - The parent class loader.types - The unloaded types to be loaded.protectionDomain - The protection domain to apply where null references an implicit protection domain.accessControlContext - The access control context to use for loading classes.persistenceHandler - The persistence handler of the created class loader.packageDefinitionStrategy - The package definer to be queried for package definitions.childFirst - true if the created class loader should apply child-first semantics when loading the types.forbidExisting - true if the class loading should throw an exception if a class was already loaded by a parent class loader.protected Class<?> findClass(String name) throws ClassNotFoundException
findClass in class ClassLoaderClassNotFoundExceptionprotected URL findResource(String name)
findResource in class ClassLoaderprotected Enumeration<URL> findResources(String name)
findResources in class ClassLoaderCopyright © 2014–2016. All rights reserved.