Package net.bytebuddy.dynamic
Class ClassFileLocator.ForUrl
- java.lang.Object
-
- net.bytebuddy.dynamic.ClassFileLocator.ForUrl
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,ClassFileLocator
- Enclosing interface:
- ClassFileLocator
@Enhance public static class ClassFileLocator.ForUrl extends java.lang.Object implements ClassFileLocator
A class file locator that reads class files from one or several URLs. The reading is accomplished via using anURLClassLoader. Doing so, boot loader resources might be located additionally to those found via the specified URLs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classClassFileLocator.ForUrl.ClassLoaderCreationActionAn 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.AgentBased, ClassFileLocator.Compound, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ClassLoaderclassLoaderThe class loader that delegates to the URLs.-
Fields inherited from interface net.bytebuddy.dynamic.ClassFileLocator
CLASS_FILE_EXTENSION
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()ClassFileLocator.Resolutionlocate(java.lang.String name)Locates the class file for a given type and returns the binary data of the class file.
-
-
-
Constructor Detail
-
ForUrl
public ForUrl(java.net.URL... url)
Creates a new class file locator for the given URLs.- Parameters:
url- The URLs to search for class files.
-
ForUrl
public ForUrl(java.util.Collection<? extends java.net.URL> urls)
Creates a new class file locator for the given URLs.- Parameters:
urls- The URLs to search for class files.
-
-
Method Detail
-
locate
public ClassFileLocator.Resolution locate(java.lang.String name) throws java.io.IOException
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:
java.io.IOException- If reading a class file causes an error.
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-