@HashCodeAndEqualsPlugin.Enhance public static class ClassFileLocator.ForModuleFile extends Object implements ClassFileLocator
ClassFileLocator.ForJarFile
is appropriate.ClassFileLocator.Compound, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForInstrumentation, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
CLASS_FILE_EXTENSION
Constructor and Description |
---|
ForModuleFile(ZipFile zipFile)
Creates a new class file locator for a jmod file.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
ClassFileLocator.Resolution |
locate(String name)
Locates the class file for a given type and returns the binary data of the class file.
|
static ClassFileLocator |
of(File file)
Returns a class file locator for the given module file.
|
static ClassFileLocator |
ofBootPath()
Creates a new class file locator for this VM's boot module path.
|
static ClassFileLocator |
ofBootPath(File bootPath)
Creates a new class file locator for a Java boot module path.
|
static ClassFileLocator |
ofModulePath()
Resolves a class file locator for this VM's Java module path that reads class files directly from the file system.
|
static ClassFileLocator |
ofModulePath(String modulePath)
Resolves a class file locator for a Java module path that reads class files directly from the file system.
|
static ClassFileLocator |
ofModulePath(String modulePath,
String baseFolder)
Resolves a class file locator for a Java module path that reads class files directly from the file system.
|
public ForModuleFile(ZipFile zipFile)
zipFile
- The represented jmod file.public static ClassFileLocator ofBootPath() throws IOException
IOException
- If an I/O error occurs.public static ClassFileLocator ofBootPath(File bootPath) throws IOException
bootPath
- The boot path folder.IOException
- If an I/O error occurs.public static ClassFileLocator ofModulePath() throws IOException
Resolves a class file locator for this VM's Java module path that reads class files directly from the file system.
Note: The resulting class file locator does not include classes of the bootstrap class loader.
IOException
- If an I/O exception occurs.public static ClassFileLocator ofModulePath(String modulePath) throws IOException
Resolves a class file locator for a Java module path that reads class files directly from the file system. All
elements of the module path are resolved relative to this VM's user.dir
.
Note: The resulting class file locator does not include classes of the bootstrap class loader.
modulePath
- The module path to scan with the elements separated by path.separator
.IOException
- If an I/O exception occurs.public static ClassFileLocator ofModulePath(String modulePath, String baseFolder) throws IOException
Resolves a class file locator for a Java module path that reads class files directly from the file system.
Note: The resulting class file locator does not include classes of the bootstrap class loader.
modulePath
- The module path to scan with the elements separated by path.separator
.baseFolder
- The relative location of the elements on the module path.IOException
- If an I/O exception occurs.public static ClassFileLocator of(File file) throws IOException
file
- The module file.IOException
- If an I/O error occurs.public ClassFileLocator.Resolution locate(String name) throws IOException
locate
in interface ClassFileLocator
name
- The name of the type to locate a class file representation for.IOException
- If reading a class file causes an error.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2014–2022. All rights reserved.