@HashCodeAndEqualsPlugin.Enhance public static class ClassFileLocator.ForJarFile extends Object implements ClassFileLocator
ClassFileLocator.AgentBased, ClassFileLocator.Compound, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
CLASS_FILE_EXTENSION
Constructor and Description |
---|
ForJarFile(JarFile jarFile)
Creates a new class file locator for the given jar 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)
Creates a new class file locator for the given jar file.
|
static ClassFileLocator |
ofClassPath()
Resolves a class file locator for the class path that reads class files directly from the file system.
|
static ClassFileLocator |
ofClassPath(String classPath)
Resolves a class file locator for the class path that reads class files directly from the file system.
|
static ClassFileLocator |
ofRuntimeJar()
Resolves a class file locator for the runtime jar.
|
public ForJarFile(JarFile jarFile)
jarFile
- The jar file to read from.public static ClassFileLocator of(File file) throws IOException
file
- The jar file to read from.IOException
- If an I/O exception is thrown.public static ClassFileLocator ofClassPath() throws IOException
IOException
- If an I/O exception occurs.public static ClassFileLocator ofClassPath(String classPath) throws IOException
Resolves a class file locator for the class 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.
classPath
- The class path to scan with the elements separated by path.separator
.IOException
- If an I/O exception occurs.public static ClassFileLocator ofRuntimeJar() throws IOException
IOException
- If an I/O exception 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–2020. All rights reserved.