@HashCodeAndEqualsPlugin.Enhance public static class ClassFileLocator.ForModuleFile extends java.lang.Object implements ClassFileLocator
ClassFileLocator.ForJarFile
is appropriate.ClassFileLocator.AgentBased, ClassFileLocator.Compound, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
Modifier and Type | Field and Description |
---|---|
private static java.util.List<java.lang.String> |
BOOT_LOCATIONS
A list of potential locations of the boot path for different platforms.
|
private static java.lang.String |
JMOD_FILE_EXTENSION
The file extension of a modular Java package.
|
private java.util.zip.ZipFile |
zipFile
The represented jmod file.
|
CLASS_FILE_EXTENSION
Constructor and Description |
---|
ForModuleFile(java.util.zip.ZipFile zipFile)
Creates a new class file locator for a jmod file.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
ClassFileLocator.Resolution |
locate(java.lang.String name)
Locates the class file for a given type and returns the binary data of the class file.
|
static ClassFileLocator |
of(java.io.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(java.io.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(java.lang.String modulePath)
Resolves a class file locator for a Java module path that reads class files directly from the file system.
|
static ClassFileLocator |
ofModulePath(java.lang.String modulePath,
java.lang.String baseFolder)
Resolves a class file locator for a Java module path that reads class files directly from the file system.
|
private static final java.lang.String JMOD_FILE_EXTENSION
private static final java.util.List<java.lang.String> BOOT_LOCATIONS
private final java.util.zip.ZipFile zipFile
public ForModuleFile(java.util.zip.ZipFile zipFile)
zipFile
- The represented jmod file.public static ClassFileLocator ofBootPath() throws java.io.IOException
java.io.IOException
- If an I/O error occurs.public static ClassFileLocator ofBootPath(java.io.File bootPath) throws java.io.IOException
bootPath
- The boot path folder.java.io.IOException
- If an I/O error occurs.public static ClassFileLocator ofModulePath() throws java.io.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.
java.io.IOException
- If an I/O exception occurs.public static ClassFileLocator ofModulePath(java.lang.String modulePath) throws java.io.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
.java.io.IOException
- If an I/O exception occurs.public static ClassFileLocator ofModulePath(java.lang.String modulePath, java.lang.String baseFolder) throws java.io.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.java.io.IOException
- If an I/O exception occurs.public static ClassFileLocator of(java.io.File file) throws java.io.IOException
file
- The module file.java.io.IOException
- If an I/O error occurs.public ClassFileLocator.Resolution locate(java.lang.String name) throws java.io.IOException
locate
in interface ClassFileLocator
name
- The name of the type to locate a class file representation for.java.io.IOException
- If reading a class file causes an error.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException