public class ModularRuntimeImage
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Field and Description |
---|---|
private java.net.URLClassLoader |
classLoader |
private java.nio.file.FileSystem |
fileSystem |
(package private) static java.lang.String |
MODULES_PATH |
(package private) static java.lang.String |
PACKAGES_PATH |
Modifier | Constructor and Description |
---|---|
|
ModularRuntimeImage()
Constructs a default instance.
|
|
ModularRuntimeImage(java.lang.String javaHome)
Constructs an instance using the JRT file system implementation from a specific Java Home.
|
private |
ModularRuntimeImage(java.net.URLClassLoader cl,
java.nio.file.FileSystem fs) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.nio.file.FileSystem |
getFileSystem() |
java.util.List<java.nio.file.Path> |
list(java.nio.file.Path dirPath)
Lists all entries in the given directory.
|
java.util.List<java.nio.file.Path> |
list(java.lang.String dirName)
Lists all entries in the given directory.
|
java.util.List<java.nio.file.Path> |
modules()
Lists all modules.
|
java.util.List<java.nio.file.Path> |
packages()
Lists all packages.
|
static final java.lang.String MODULES_PATH
static final java.lang.String PACKAGES_PATH
private final java.net.URLClassLoader classLoader
private final java.nio.file.FileSystem fileSystem
public ModularRuntimeImage() throws java.io.IOException
java.io.IOException
- an I/O error occurs accessing the file systempublic ModularRuntimeImage(java.lang.String javaHome) throws java.io.IOException
javaHome
- Path to a Java 9 or greater home.java.io.IOException
- an I/O error occurs accessing the file systemprivate ModularRuntimeImage(java.net.URLClassLoader cl, java.nio.file.FileSystem fs)
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public java.util.List<java.nio.file.Path> list(java.nio.file.Path dirPath) throws java.io.IOException
dirPath
- directory path.java.io.IOException
- an I/O error occurs accessing the file systempublic java.util.List<java.nio.file.Path> list(java.lang.String dirName) throws java.io.IOException
dirName
- directory path.java.io.IOException
- an I/O error occurs accessing the file systempublic java.util.List<java.nio.file.Path> modules() throws java.io.IOException
java.io.IOException
- an I/O error occurs accessing the file systempublic java.util.List<java.nio.file.Path> packages() throws java.io.IOException
java.io.IOException
- an I/O error occurs accessing the file systempublic java.nio.file.FileSystem getFileSystem()