Modifier and Type | Class and Description |
---|---|
private static class | ModulePatcher.
A ResourceFinder that finds resources on the file system. |
private static class | ModulePatcher.
A ResourceFinder that finds resources in a JAR file. |
public static class | ModulePatcher.
A ModuleReader that reads resources from a patched module. |
private static interface | ModulePatcher.
A resource finder that find resources in a patch location. |
Modifier and Type | Field and Description |
---|---|
private static final JavaLangModuleAccess | |
private final Map |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public boolean | |
private boolean | |
pack-priv Set | |
public ModuleReference | patchIfNeeded(ModuleReference mref)
Returns a module reference that interposes on the given module if needed. |
private static String | toPackageName(Path top, Path file)
Derives a package name from the file path of an entry in an exploded patch |
private static String | toPackageName(Path file, JarEntry entry)
Derives a package name from the name of an entry in a JAR file. |
private static String |
JLMA | back to summary |
---|---|
private static final JavaLangModuleAccess JLMA |
map | back to summary |
---|---|
private final Map<String, List<Path>> map |
ModulePatcher | back to summary |
---|---|
public ModulePatcher(Map<String, List<String>> input) Initialize the module patcher with the given map. The map key is the module name, the value is a list of path strings. |
hasPatches | back to summary |
---|---|
public boolean hasPatches() Returns true is this module patcher has patches. |
isHidden | back to summary |
---|---|
private boolean isHidden(Path file) Returns true if the given file exists and is a hidden file |
patchedModules | back to summary |
---|---|
pack-priv Set |
patchIfNeeded | back to summary |
---|---|
public ModuleReference patchIfNeeded(ModuleReference mref) Returns a module reference that interposes on the given module if needed. If there are no patches for the given module then the module reference is simply returned. Otherwise the patches for the module are scanned (to find any new packages) and a new module reference is returned.
|
toPackageName | back to summary |
---|---|
private static String toPackageName(Path top, Path file) Derives a package name from the file path of an entry in an exploded patch |
toPackageName | back to summary |
---|---|
private static String toPackageName(Path file, JarEntry entry) Derives a package name from the name of an entry in a JAR file. |
warnIfModuleInfo | back to summary |
---|---|
private static String warnIfModuleInfo(Path file, String e) |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
public Resource | |
public Stream | |
private Resource |
dir | back to summary |
---|---|
private final Path dir |
ExplodedResourceFinder | back to summary |
---|---|
pack-priv ExplodedResourceFinder(Path dir) |
close | back to summary |
---|---|
public void close() Implements java. Doc from java. 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
|
find | back to summary |
---|---|
public Resource find(String name) throws IOException Implements jdk.
|
list | back to summary |
---|---|
public Stream Implements jdk.
|
newResource | back to summary |
---|---|
private Resource newResource(String name, Path top, Path file) |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
public Resource | |
public Stream |
csURL | back to summary |
---|---|
private final URL csURL |
jf | back to summary |
---|---|
private final JarFile jf |
JarResourceFinder | back to summary |
---|---|
pack-priv JarResourceFinder(Path path) throws IOException |
close | back to summary |
---|---|
public void close() throws IOException Implements java. Doc from java. 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
|
find | back to summary |
---|---|
public Resource find(String name) throws IOException Implements jdk.
|
list | back to summary |
---|---|
public Stream Implements jdk.
|
Modifier and Type | Field and Description |
---|---|
private volatile ModuleReader | |
private final URL | |
private final List | |
private final ModuleReference |
Access | Constructor and Description |
---|---|
pack-priv | PatchedModuleReader(List<Path> patches, ModuleReference mref)
Creates the ModuleReader to reads resources in a patched module. |
Modifier and Type | Method and Description |
---|---|
public void | |
private static void | |
private static URL | |
private ModuleReader | delegate()
Returns the ModuleReader to delegate to when the resource is not found in a patch location. |
public Optional | find(String
The name of the resource to open for reading name)Implements java. Finds a resource, returning a URI to the resource in the module. |
public Resource | |
private Resource | |
public Stream | list()
Implements java. Lists the contents of the module, returning a stream of elements that are the names of all resources in the module. |
public Optional | open(String
The name of the resource to open for reading name)Overrides default java. Opens a resource, returning an input stream to read the resource in the module. |
public Optional | read(String
The name of the resource to read name)Overrides default java. Reads a resource, returning a byte buffer with the contents of the resource. |
public void | release(ByteBuffer
The byte buffer to release bb)Overrides default java. Releases a byte buffer. |
delegate | back to summary |
---|---|
private volatile ModuleReader delegate |
delegateCodeSourceURL | back to summary |
---|---|
private final URL delegateCodeSourceURL |
finders | back to summary |
---|---|
private final List<ModulePatcher. |
mref | back to summary |
---|---|
private final ModuleReference mref |
PatchedModuleReader | back to summary |
---|---|
pack-priv PatchedModuleReader(List<Path> patches, ModuleReference mref) Creates the ModuleReader to reads resources in a patched module. |
close | back to summary |
---|---|
public void close() throws IOException Implements java. Doc from java. Closes the module reader. Once closed then subsequent calls to locate or
read a resource will fail by throwing A module reader is not required to be asynchronously closeable. If a thread is reading a resource and another thread invokes the close method, then the second thread may block until the read operation is complete.
|
closeAll | back to summary |
---|---|
private static void closeAll(List<ModulePatcher. Closes all resource finders. |
codeSourceURL | back to summary |
---|---|
private static URL codeSourceURL(ModuleReference mref) Returns the code source URL for the given module. |
delegate | back to summary |
---|---|
private ModuleReader delegate() throws IOException Returns the ModuleReader to delegate to when the resource is not found in a patch location. |
find | back to summary |
---|---|
public Optional Implements java. Doc from java. Finds a resource, returning a URI to the resource in the module. If the module reader can determine that the name locates a directory then the resulting URI will end with a slash ('/').
|
findResource | back to summary |
---|---|
public Resource findResource(String name) throws IOException Finds a resource of the given name in the patched module. |
findResourceInPatch | back to summary |
---|---|
private Resource findResourceInPatch(String name) throws IOException Finds a resources in the patch locations. Returns null if not found or the name is "module-info.class" as that cannot be overridden. |
list | back to summary |
---|---|
public Stream Implements java. Doc from java. Lists the contents of the module, returning a stream of elements that are the names of all resources in the module. Whether the stream of elements includes names corresponding to directories in the module is module reader specific. In lazy implementations then an The returned stream may contain references to one or more open directories in the module. The directories are closed by closing the stream. The behavior of the stream when used after the module reader is closed is implementation specific and therefore not specified.
|
open | back to summary |
---|---|
public Optional Overrides default java. Doc from java. Opens a resource, returning an input stream to read the resource in the module. The behavior of the input stream when used after the module reader is closed is implementation specific and therefore not specified.
|
read | back to summary |
---|---|
public Optional Overrides default java. Doc from java. Reads a resource, returning a byte buffer with the contents of the
resource.
The element at the returned buffer's position is the first byte of the
resource, the element at the buffer's limit is the last byte of the
resource. Once consumed, the
|
release | back to summary |
---|---|
public void release(ByteBuffer bb) Overrides default java. Doc from java. Releases a byte buffer. This method should be invoked after consuming
the contents of the buffer returned by the
|
Modifier and Type | Method and Description |
---|---|
public Resource | |
public Stream |
find | back to summary |
---|---|
public Resource find(String name) throws IOException |
list | back to summary |
---|---|
public Stream |