Package net.bytebuddy.dynamic
Class ClassFileLocator.MultiReleaseAware
- java.lang.Object
-
- net.bytebuddy.dynamic.ClassFileLocator.MultiReleaseAware
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ClassFileLocator
- Direct Known Subclasses:
ClassFileLocator.ForFolder
,ClassFileLocator.ForJarFile
- Enclosing interface:
- ClassFileLocator
@Enhance public abstract static class ClassFileLocator.MultiReleaseAware extends java.lang.Object implements ClassFileLocator
A class file locator that is aware of multi-release JAR file semantics.
-
-
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 static java.lang.String
MULTI_RELEASE_ATTRIBUTE
The property name of a multi-release JAR file.protected static int[]
NO_MULTI_RELEASE
Indicates that no multi-release versions exist.private int[]
version
Contains the existing multi-release jar folders that are available for the current JVM version in decreasing order.-
Fields inherited from interface net.bytebuddy.dynamic.ClassFileLocator
CLASS_FILE_EXTENSION, META_INF_VERSIONS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MultiReleaseAware(int[] version)
Creates a multi-release aware class file locator.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract byte[]
doLocate(java.lang.String path)
Resolves a possible multi-release entry, if it exists.ClassFileLocator.Resolution
locate(java.lang.String name)
Locates the class file for a given type and returns the binary data of the class file.
-
-
-
Field Detail
-
MULTI_RELEASE_ATTRIBUTE
private static final java.lang.String MULTI_RELEASE_ATTRIBUTE
The property name of a multi-release JAR file.- See Also:
- Constant Field Values
-
NO_MULTI_RELEASE
protected static final int[] NO_MULTI_RELEASE
Indicates that no multi-release versions exist.
-
version
private final int[] version
Contains the existing multi-release jar folders that are available for the current JVM version in decreasing order.
-
-
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:
locate
in 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.
-
doLocate
@MaybeNull protected abstract byte[] doLocate(java.lang.String path) throws java.io.IOException
Resolves a possible multi-release entry, if it exists.- Parameters:
path
- The path of the class file.- Returns:
- The class file's binary representation or
null
if it does not exist. - Throws:
java.io.IOException
- If an I/O exception occurs.
-
-