Class ClassFileLocator.ForFolder

java.lang.Object
net.bytebuddy.dynamic.ClassFileLocator.MultiReleaseAware
net.bytebuddy.dynamic.ClassFileLocator.ForFolder
All Implemented Interfaces:
Closeable, 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>.class files within their package folder.
  • Field Details

    • folder

      private final File folder
      The base folder of the package structure.
  • Constructor Details

    • ForFolder

      public ForFolder(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, 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 Details

    • of

      public static ClassFileLocator of(File folder, ClassFileVersion classFileVersion) throws 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:
      IOException - If an I/O exception occurs.
    • doLocate

      @MaybeNull protected byte[] doLocate(String path) throws IOException
      Resolves a possible multi-release entry, if it exists.
      Specified by:
      doLocate in class ClassFileLocator.MultiReleaseAware
      Parameters:
      path - The path of the class file.
      Returns:
      The class file's binary representation or null if it does not exist.
      Throws:
      IOException - If an I/O exception occurs.
    • close

      public void close()