Package net.bytebuddy.dynamic
Class ClassFileLocator.ForUrl
java.lang.Object
net.bytebuddy.dynamic.ClassFileLocator.ForUrl
- All Implemented Interfaces:
Closeable,AutoCloseable,ClassFileLocator
- Enclosing interface:
ClassFileLocator
A class file locator that reads class files from one or several URLs. The reading is accomplished via using an
URLClassLoader.
Doing so, boot loader resources might be located additionally to those found via the specified URLs.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAn action to create a class loader with the purpose of locating classes from an URL location.Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.ClassFileLocator
ClassFileLocator.Compound, ClassFileLocator.Filtering, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForInstrumentation, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClassLoaderThe class loader that delegates to the URLs.Fields inherited from interface net.bytebuddy.dynamic.ClassFileLocator
CLASS_FILE_EXTENSION -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new class file locator for the given URLs.ForUrl(Collection<? extends URL> urls) Creates a new class file locator for the given URLs. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()private static <T> TdoPrivileged(PrivilegedAction<T> action) A proxy forjava.security.AccessController#doPrivilegedthat is activated if available.Locates the class file for a given type and returns the binary data of the class file.
-
Field Details
-
classLoader
The class loader that delegates to the URLs.
-
-
Constructor Details
-
ForUrl
Creates a new class file locator for the given URLs.- Parameters:
url- The URLs to search for class files.
-
ForUrl
Creates a new class file locator for the given URLs.- Parameters:
urls- The URLs to search for class files.
-
-
Method Details
-
doPrivileged
A proxy forjava.security.AccessController#doPrivilegedthat is activated if available.- Type Parameters:
T- The type of the action's resolved value.- Parameters:
action- The action to execute from a privileged context.- Returns:
- The action's resolved value.
-
locate
Locates the class file for a given type and returns the binary data of the class file.- Specified by:
locatein interfaceClassFileLocator- Parameters:
name- The name of the type to locate a class file representation for.- Returns:
- Any binary representation of the type which might be illegal.
- Throws:
IOException- If reading a class file causes an error.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-