JrtFileSystem and other utilities.
Entries in jimage are expressed as one of three Node types;
resource nodes, directory nodes and link nodes.
When remapping jimage entries, jimage location names (e.g. "/java.base/java/lang/Integer.class") are prefixed with "/modules"
to form the names of resource nodes. This aligns with the naming of module
entries in jimage (e.g. "/modules/java.base/java/lang"), which appear as
directory nodes in ImageReader.
Package entries (e.g. "/packages/java.lang" appear as directory
nodes containing link nodes, which resolve back to the root directory of the
module in which that package exists (e.g. "/modules/java.base").
Unlike other nodes, the jimage file does not contain explicit entries for
link nodes, and their existence is derived only from the contents of the
parent directory.
While similar to BasicImageReader, this class is not a conceptual
subtype of it, and deliberately hides types such as ImageLocation to
give a focused API based only on nodes.
Implementation Note
This class needs to maintain JDK 8 source compatibility. It is used internally in the JDK to implement jimage/jrtfs access, but also compiled and delivered as part of the jrtfs.jar to support access to the jimage file provided by the shipped JDK by tools running on JDK 8.
| Modifier and Type | Class and Description |
|---|---|
| private static class | ImageReader.
Directory node (referenced from a full path, without a trailing '/'). |
| private static class | ImageReader.
Link node (a symbolic link to a top-level modules directory). |
| public abstract static class | ImageReader.
A directory, resource or symbolic link. |
| private static class | ImageReader.
Resource node (e.g. a ".class" entry, or any other data resource). |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private volatile boolean | |
| private static final String | |
| private final ImageReader. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements java. Closes this resource, relinquishing any underlying resources. |
| public boolean | containsResource(String
The module name of the resource being tested for. moduleName, String Trailing module-relative resource path, not starting
with resourcePath)'/'.Returns whether a resource exists in the given module. |
| private void | |
| public ImageReader. | |
| public ImageReader. | findResourceNode(String
The module name of the requested resource. moduleName, String Trailing module-relative resource path, not starting
with resourcePath)'/'.Returns a resource node in the given module, or null if no resource of that name exists. |
| public byte[] | |
| public ByteBuffer | getResourceBuffer(ImageReader.
Returns the content of a resource node in a newly allocated byte buffer. |
| pack-priv ResourceEntries | |
| public static ImageReader | open(Path
file system path of the jimage file. imagePath, PreviewMode whether to return preview resources. mode)Opens an image reader for a jimage file at the specified path. |
| public static ImageReader | open(Path
file system path of the jimage file. imagePath, ByteOrder the byte-order to be used when reading the jimage file. byteOrder, PreviewMode controls whether preview resources are visible. mode)Opens an image reader for a jimage file at the specified path. |
| private void |