Top Description Fields Constructors Methods
org.apache.bcel.util

public Class ModularRuntimeImage

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, .File, .IOException, java.net.URI, .URL, .URLClassLoader, java.nio.file.DirectoryStream, .FileSystem, .FileSystems, .Files, .Path, .Paths, java.util.ArrayList, .Collections, .List, .Map

Wraps a Java 9 JEP 220 modular runtime image. Requires the JRT NIO file system.
Since
6.3

Field Summary

Modifier and TypeField and Description
private final URLClassLoader
private final FileSystem
pack-priv static final String
pack-priv static final String

Constructor Summary

AccessConstructor and Description
public
ModularRuntimeImage()

Constructs a default instance.

public
ModularRuntimeImage(final String
Path to a Java 9 or greater home.
javaHome
)

Constructs an instance using the JRT file system implementation from a specific Java Home.

private

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public FileSystem
public List<Path>

Returns:

a list of dir entries if an I/O error occurs
list
(final Path
directory path.
dirPath
)

Lists all entries in the given directory.

public List<Path>

Returns:

a list of dir entries if an I/O error occurs
list
(final String
directory path.
dirName
)

Lists all entries in the given directory.

public List<Path>

Returns:

a list of modules
modules
()

Lists all modules.

public List<Path>

Returns:

a list of modules
packages
()

Lists all packages.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classLoaderback to summary
private final URLClassLoader classLoader
fileSystemback to summary
private final FileSystem fileSystem
MODULES_PATHback to summary
pack-priv static final String MODULES_PATH
PACKAGES_PATHback to summary
pack-priv static final String PACKAGES_PATH

Constructor Detail

ModularRuntimeImageback to summary
public ModularRuntimeImage()

Constructs a default instance.

Annotations
@SuppressWarnings:resource
ModularRuntimeImageback to summary
public ModularRuntimeImage(final String javaHome) throws IOException

Constructs an instance using the JRT file system implementation from a specific Java Home.

Parameters
javaHome:String

Path to a Java 9 or greater home.

Exceptions
IOException:
an I/O error occurs accessing the file system
ModularRuntimeImageback to summary
private ModularRuntimeImage(final URLClassLoader cl, final FileSystem fs)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getFileSystemback to summary
public FileSystem getFileSystem()
listback to summary
public List<Path> list(final Path dirPath) throws IOException

Lists all entries in the given directory.

Parameters
dirPath:Path

directory path.

Returns:List<Path>

a list of dir entries if an I/O error occurs

Exceptions
IOException:
an I/O error occurs accessing the file system
listback to summary
public List<Path> list(final String dirName) throws IOException

Lists all entries in the given directory.

Parameters
dirName:String

directory path.

Returns:List<Path>

a list of dir entries if an I/O error occurs

Exceptions
IOException:
an I/O error occurs accessing the file system
modulesback to summary
public List<Path> modules() throws IOException

Lists all modules.

Returns:List<Path>

a list of modules

Exceptions
IOException:
an I/O error occurs accessing the file system
packagesback to summary
public List<Path> packages() throws IOException

Lists all packages.

Returns:List<Path>

a list of modules

Exceptions
IOException:
an I/O error occurs accessing the file system