Package net.bytebuddy.dynamic
Class ClassFileLocator.ForFolder
- java.lang.Object
-
- net.bytebuddy.dynamic.ClassFileLocator.MultiReleaseAware
-
- net.bytebuddy.dynamic.ClassFileLocator.ForFolder
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,ClassFileLocator
- Enclosing interface:
- ClassFileLocator
@Enhance public static class ClassFileLocator.ForFolder extends ClassFileLocator.MultiReleaseAware
A class file locator that finds files from a standardized Java folder structure with folders donating packages and class files being saved as<classname>.classfiles within their package folder.
-
-
Nested Class Summary
-
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.MultiReleaseAware, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.FilefolderThe base folder of the package structure.-
Fields inherited from class net.bytebuddy.dynamic.ClassFileLocator.MultiReleaseAware
NO_MULTI_RELEASE
-
Fields inherited from interface net.bytebuddy.dynamic.ClassFileLocator
CLASS_FILE_EXTENSION, META_INF_VERSIONS
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected byte[]doLocate(java.lang.String path)Resolves a possible multi-release entry, if it exists.static ClassFileLocatorof(java.io.File folder, ClassFileVersion classFileVersion)Creates a new class file locator for a folder structure of class files.-
Methods inherited from class net.bytebuddy.dynamic.ClassFileLocator.MultiReleaseAware
locate
-
-
-
-
Constructor Detail
-
ForFolder
public ForFolder(java.io.File folder)
Creates a new class file locator for a folder structure of class files.- Parameters:
folder- The base folder of the package structure.
-
ForFolder
protected ForFolder(int[] version, java.io.File folder)Creates a new class file locator for a folder structure of class files.- Parameters:
version- Contains the existing multi-release jar folders that are available for the current JVM version in decreasing order.folder- The base folder of the package structure.
-
-
Method Detail
-
of
public static ClassFileLocator of(java.io.File folder, ClassFileVersion classFileVersion) throws java.io.IOException
Creates a new class file locator for a folder structure of class files. The created locator considers the provided class file version when resolving class files and if multiple versions are available- Parameters:
folder- The base folder of the package structure.classFileVersion- The class file version to consider for multi-release JAR files.- Returns:
- An appropriate class file locator.
- Throws:
java.io.IOException- If an I/O exception occurs.
-
doLocate
@MaybeNull protected byte[] doLocate(java.lang.String path) throws java.io.IOException
Resolves a possible multi-release entry, if it exists.- Specified by:
doLocatein classClassFileLocator.MultiReleaseAware- Parameters:
path- The path of the class file.- Returns:
- The class file's binary representation or
nullif it does not exist. - Throws:
java.io.IOException- If an I/O exception occurs.
-
close
public void close()
-
-