APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.jrtfs

pack-priv Class ExplodedImage

extends SystemImage
Class Inheritance
Imports
java.io.IOException, .UncheckedIOException, java.nio.file.DirectoryStream, .FileSystemException, .Files, .Path, java.nio.file.attribute.BasicFileAttributes, java.util.ArrayList, .HashMap, .List, .Map, .Objects, java.util.stream.Stream, jdk.internal.jimage.ImageReader.Node

A jrt file system built on $JAVA_HOME/modules directory ('exploded modules build')

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private static final String
private final Path
private final BasicFileAttributes
private final Map<String, ExplodedImage.PathNode>
private static final String
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
ExplodedImage(Path modulesDir)

Method Summary

Modifier and TypeMethod and Description
public synchronized void
close()

Implements abstract jdk.internal.jrtfs.SystemImage.close.

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

private ImageReader.Node

Returns:

the newly created and cached node, or null if the given path references a file which must be hidden in the node hierarchy.
createModulesNode
(String
a resource or directory node name, of the form "/modules/...".
name
,
Path
the path of a file for a resource or directory.
path
)

Lazily creates and caches a Node for the given "/modules/..." name and corresponding path to a file or directory.

public synchronized ImageReader.Node
private String
public byte[]
private void
private static boolean
private String
private String
private Path
underlyingModulesPath(String name)

Returns the expected file path for name in the "/modules/..." namespace, or null if the name is not in the "/modules/..." namespace or the path does not reference a file.

Inherited from jdk.internal.jrtfs.SystemImage:
fromDirectoryfromJimageopen

Field Detail

MODULESback to summary
private static final String MODULES
modulesDirback to summary
private final Path modulesDir
modulesDirAttrsback to summary
private final BasicFileAttributes modulesDirAttrs
nodesback to summary
private final Map<String, ExplodedImage.PathNode> nodes
PACKAGESback to summary
private static final String PACKAGES
separatorback to summary
private final String separator

Constructor Detail

ExplodedImageback to summary
pack-priv ExplodedImage(Path modulesDir) throws IOException

Method Detail

closeback to summary
public synchronized void close() throws IOException

Implements abstract jdk.internal.jrtfs.SystemImage.close.

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
createModulesNodeback to summary
private ImageReader.Node createModulesNode(String name, Path path)

Lazily creates and caches a Node for the given "/modules/..." name and corresponding path to a file or directory.

Parameters
name:String

a resource or directory node name, of the form "/modules/...".

path:Path

the path of a file for a resource or directory.

Returns:ImageReader.Node

the newly created and cached node, or null if the given path references a file which must be hidden in the node hierarchy.

findNodeback to summary
public synchronized ImageReader.Node findNode(String name)

Implements abstract jdk.internal.jrtfs.SystemImage.findNode.

Annotations
@Override
frontSlashToNativeSlashback to summary
private String frontSlashToNativeSlash(String str)
getResourceback to summary
public byte[] getResource(ImageReader.Node node) throws IOException

Implements abstract jdk.internal.jrtfs.SystemImage.getResource.

Annotations
@Override
initNodesback to summary
private void initNodes() throws IOException
isNonEmptyModulesPathback to summary
private static boolean isNonEmptyModulesPath(String name)
nativeSlashToFrontSlashback to summary
private String nativeSlashToFrontSlash(String str)
slashesToDotsback to summary
private String slashesToDots(String str)
underlyingModulesPathback to summary
private Path underlyingModulesPath(String name)

Returns the expected file path for name in the "/modules/..." namespace, or null if the name is not in the "/modules/..." namespace or the path does not reference a file.

jdk.internal.jrtfs back to summary

private final Class ExplodedImage.PathNode

extends Node
Class Inheritance

Field Summary

Modifier and TypeField and Description
private List<ImageReader.Node>
private ExplodedImage.PathNode
private Path

Constructor Summary

AccessConstructor and Description
private
private
private
PathNode(String name, List<ImageReader.Node> children)

Method Summary

Modifier and TypeMethod and Description
public Stream<String>
getChildNames()

Overrides jdk.internal.jimage.ImageReader.Node.getChildNames.

Returns the fully qualified names of any child nodes for a directory.

private byte[]
public boolean
isDirectory()

Overrides jdk.internal.jimage.ImageReader.Node.isDirectory.

Returns whether this node is a directory.

public boolean
isResource()

Overrides jdk.internal.jimage.ImageReader.Node.isResource.

Returns whether this node is a resource.

public long
size()

Overrides jdk.internal.jimage.ImageReader.Node.size.

Returns the uncompressed size of this node's content.

Inherited from jdk.internal.jimage.ImageReader.Node:
compressedSizeequalsextensiongetFileAttributesgetNamehashCoderesolveLinktoString

Field Detail

childrenback to summary
private List<ImageReader.Node> children
pathback to summary
private Path path

Constructor Detail

PathNodeback to summary
private PathNode(String name, Path path, BasicFileAttributes attrs)
PathNodeback to summary
private PathNode(String name, ImageReader.Node link)
PathNodeback to summary
private PathNode(String name, List<ImageReader.Node> children)

Method Detail

getChildNamesback to summary
public Stream<String> getChildNames()

Overrides jdk.internal.jimage.ImageReader.Node.getChildNames.

Doc from jdk.internal.jimage.ImageReader.Node.getChildNames.

Returns the fully qualified names of any child nodes for a directory.

By default, this method throws IllegalStateException and is overridden for directories.

Annotations
@Override
getContentback to summary
private byte[] getContent() throws IOException
isDirectoryback to summary
public boolean isDirectory()

Overrides jdk.internal.jimage.ImageReader.Node.isDirectory.

Doc from jdk.internal.jimage.ImageReader.Node.isDirectory.

Returns whether this node is a directory. Directory nodes can have getChildNames() invoked to get the fully qualified names of any child nodes.

Annotations
@Override
isResourceback to summary
public boolean isResource()

Overrides jdk.internal.jimage.ImageReader.Node.isResource.

Doc from jdk.internal.jimage.ImageReader.Node.isResource.

Returns whether this node is a resource. Resource nodes can have their contents obtained via ImageReader#getResource(Node) or ImageReader#getResourceBuffer(Node).

Annotations
@Override
sizeback to summary
public long size()

Overrides jdk.internal.jimage.ImageReader.Node.size.

Doc from jdk.internal.jimage.ImageReader.Node.size.

Returns the uncompressed size of this node's content. If this node is not a resource, this method returns zero.

Annotations
@Override