public class ByteArrayClassLoader extends InjectionClassLoader
 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.
 Note: Any class and package definition is performed using the creator's java.security.AccessControlContext.
 
| Modifier and Type | Class and Description | 
|---|---|
| static class  | ByteArrayClassLoader.ChildFirst
 A  ByteArrayClassLoaderwhich applies child-first semantics for the
 given type definitions. | 
| protected class  | ByteArrayClassLoader.ClassDefinitionActionAn action for defining a located class that is not yet loaded. | 
| protected static class  | ByteArrayClassLoader.EmptyEnumerationAn enumeration without any elements. | 
| protected static interface  | ByteArrayClassLoader.PackageLookupStrategyA package lookup strategy for locating a package by name. | 
| static class  | ByteArrayClassLoader.PersistenceHandlerA persistence handler decides on whether 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. | 
| protected static interface  | ByteArrayClassLoader.SynchronizationStrategyAn engine for receiving a class loading lock when loading a class. | 
InjectionClassLoader.Strategy| Modifier and Type | Field and Description | 
|---|---|
| protected Object | accessControlContextThe access control context to use for loading classes or  nullif this is not supported on the current VM. | 
| protected ClassFilePostProcessor | classFilePostProcessorThe class file transformer to apply on loaded 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 static ByteArrayClassLoader.SynchronizationStrategy.Initializable | SYNCHRONIZATION_STRATEGYThe synchronization engine for the executing JVM. | 
| protected ConcurrentMap<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,
                    boolean sealed,
                    Map<String,byte[]> typeDefinitions)Creates a new class loader for a given definition of classes. | 
| ByteArrayClassLoader(ClassLoader parent,
                    boolean sealed,
                    Map<String,byte[]> typeDefinitions,
                    ByteArrayClassLoader.PersistenceHandler persistenceHandler)Creates a new class loader for a given definition of classes. | 
| ByteArrayClassLoader(ClassLoader parent,
                    boolean sealed,
                    Map<String,byte[]> typeDefinitions,
                    ProtectionDomain protectionDomain,
                    ByteArrayClassLoader.PersistenceHandler persistenceHandler,
                    PackageDefinitionStrategy packageDefinitionStrategy)Creates a new class loader for a given definition of classes. | 
| ByteArrayClassLoader(ClassLoader parent,
                    boolean sealed,
                    Map<String,byte[]> typeDefinitions,
                    ProtectionDomain protectionDomain,
                    ByteArrayClassLoader.PersistenceHandler persistenceHandler,
                    PackageDefinitionStrategy packageDefinitionStrategy,
                    ClassFilePostProcessor classFilePostProcessor)Creates a new class loader for a given definition of classes. | 
| ByteArrayClassLoader(ClassLoader parent,
                    Map<String,byte[]> typeDefinitions)Creates a new class loader for a given definition of classes. | 
| ByteArrayClassLoader(ClassLoader parent,
                    Map<String,byte[]> typeDefinitions,
                    ByteArrayClassLoader.PersistenceHandler persistenceHandler)Creates a new class loader for a given definition of classes. | 
| ByteArrayClassLoader(ClassLoader parent,
                    Map<String,byte[]> typeDefinitions,
                    ProtectionDomain protectionDomain,
                    ByteArrayClassLoader.PersistenceHandler persistenceHandler,
                    PackageDefinitionStrategy packageDefinitionStrategy)Creates a new class loader for a given definition of classes. | 
| ByteArrayClassLoader(ClassLoader parent,
                    Map<String,byte[]> typeDefinitions,
                    ProtectionDomain protectionDomain,
                    ByteArrayClassLoader.PersistenceHandler persistenceHandler,
                    PackageDefinitionStrategy packageDefinitionStrategy,
                    ClassFilePostProcessor classFilePostProcessor)Creates a new class loader for a given definition of classes. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected Map<String,Class<?>> | doDefineClasses(Map<String,byte[]> typeDefinitions)Defines a group of types to be loaded by this class loader. | 
| 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)Loads a given set of class descriptions and their binary representations. | 
| static Map<TypeDescription,Class<?>> | load(ClassLoader classLoader,
    Map<TypeDescription,byte[]> types,
    ProtectionDomain protectionDomain,
    ByteArrayClassLoader.PersistenceHandler persistenceHandler,
    PackageDefinitionStrategy packageDefinitionStrategy,
    boolean forbidExisting,
    boolean sealed)Loads a given set of class descriptions and their binary representations. | 
defineClass, defineClasses, isSealed, sealclearAssertionStatus, 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 static final ByteArrayClassLoader.SynchronizationStrategy.Initializable SYNCHRONIZATION_STRATEGY
protected final ConcurrentMap<String,byte[]> typeDefinitions
protected final ByteArrayClassLoader.PersistenceHandler persistenceHandler
@MaybeNull protected final ProtectionDomain protectionDomain
null when referencing the default protection domain.protected final PackageDefinitionStrategy packageDefinitionStrategy
protected final ClassFilePostProcessor classFilePostProcessor
@MaybeNull protected final Object accessControlContext
null if this is not supported on the current VM.public ByteArrayClassLoader(@MaybeNull ClassLoader parent, Map<String,byte[]> typeDefinitions)
parent - The ClassLoader that is the parent of this class loader.typeDefinitions - A map of fully qualified class names pointing to their binary representations.public ByteArrayClassLoader(@MaybeNull ClassLoader parent, boolean sealed, Map<String,byte[]> typeDefinitions)
parent - The ClassLoader that is the parent of this class loader.sealed - true if this class loader is sealed.typeDefinitions - A map of fully qualified class names pointing to their binary representations.public ByteArrayClassLoader(@MaybeNull ClassLoader parent, Map<String,byte[]> typeDefinitions, ByteArrayClassLoader.PersistenceHandler persistenceHandler)
parent - The ClassLoader that is the parent of this class loader.typeDefinitions - A map of fully qualified class names pointing to their binary representations.persistenceHandler - The persistence handler of this class loader.public ByteArrayClassLoader(@MaybeNull ClassLoader parent, boolean sealed, Map<String,byte[]> typeDefinitions, ByteArrayClassLoader.PersistenceHandler persistenceHandler)
parent - The ClassLoader that is the parent of this class loader.sealed - true if this class loader is sealed.typeDefinitions - A map of fully qualified class names pointing to their binary representations.persistenceHandler - The persistence handler of this class loader.public ByteArrayClassLoader(@MaybeNull ClassLoader parent, Map<String,byte[]> typeDefinitions, @MaybeNull ProtectionDomain protectionDomain, 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.packageDefinitionStrategy - The package definer to be queried for package definitions.persistenceHandler - The persistence handler of this class loader.public ByteArrayClassLoader(@MaybeNull ClassLoader parent, boolean sealed, Map<String,byte[]> typeDefinitions, @MaybeNull ProtectionDomain protectionDomain, ByteArrayClassLoader.PersistenceHandler persistenceHandler, PackageDefinitionStrategy packageDefinitionStrategy)
parent - The ClassLoader that is the parent of this class loader.sealed - true if this class loader is sealed.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.packageDefinitionStrategy - The package definer to be queried for package definitions.persistenceHandler - The persistence handler of this class loader.public ByteArrayClassLoader(@MaybeNull ClassLoader parent, Map<String,byte[]> typeDefinitions, @MaybeNull ProtectionDomain protectionDomain, ByteArrayClassLoader.PersistenceHandler persistenceHandler, PackageDefinitionStrategy packageDefinitionStrategy, ClassFilePostProcessor classFilePostProcessor)
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.packageDefinitionStrategy - The package definer to be queried for package definitions.persistenceHandler - The persistence handler of this class loader.classFilePostProcessor - A post processor for class files to apply ppublic ByteArrayClassLoader(@MaybeNull ClassLoader parent, boolean sealed, Map<String,byte[]> typeDefinitions, @MaybeNull ProtectionDomain protectionDomain, ByteArrayClassLoader.PersistenceHandler persistenceHandler, PackageDefinitionStrategy packageDefinitionStrategy, ClassFilePostProcessor classFilePostProcessor)
parent - The ClassLoader that is the parent of this class loader.sealed - true if this class loader is sealed.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.packageDefinitionStrategy - The package definer to be queried for package definitions.persistenceHandler - The persistence handler of this class loader.classFilePostProcessor - A post processor for class files to apply ppublic static Map<TypeDescription,Class<?>> load(@MaybeNull ClassLoader classLoader, Map<TypeDescription,byte[]> types)
classLoader - The parent class loader.types - The unloaded types to be loaded.public static Map<TypeDescription,Class<?>> load(@MaybeNull ClassLoader classLoader, Map<TypeDescription,byte[]> types, @MaybeNull ProtectionDomain protectionDomain, ByteArrayClassLoader.PersistenceHandler persistenceHandler, PackageDefinitionStrategy packageDefinitionStrategy, boolean forbidExisting, boolean sealed)
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.persistenceHandler - The persistence handler of the created class loader.packageDefinitionStrategy - The package definer to be queried for package definitions.forbidExisting - true if the class loading should throw an exception if a class was already loaded by a parent class loader.sealed - true if the class loader should be sealed.protected Map<String,Class<?>> doDefineClasses(Map<String,byte[]> typeDefinitions) throws ClassNotFoundException
InjectionClassLoaderdoDefineClasses in class InjectionClassLoadertypeDefinitions - The types binary representations.ClassNotFoundException - If the class could not be loaded.protected Class<?> findClass(String name) throws ClassNotFoundException
findClass in class ClassLoaderClassNotFoundException@MaybeNull protected URL findResource(String name)
findResource in class ClassLoaderprotected Enumeration<URL> findResources(String name)
findResources in class ClassLoaderCopyright © 2014–2024. All rights reserved.