You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two reflection-based wrapper classes are provided for accessing modules, ModuleRef which proxies calls to ModuleReference, and ModuleReaderProxy which proxies calls to ModuleReader, for backwards compatibility when compiling code for JDK 7 and JDK 8. These proxy classes provide some additional convenience methods over the JDK versions they wrap.
Holds a reference to a module. This is a JDK 7/8 compatible, introspection-based wrapper for JPMS' ModuleReference class.
.getName() returns the name of the module as a String.
.getRawVersion() returns the raw version of the module as a String, or null if there was no version information available.
.getLocation() returns the location of the module as a URI.
.getLocationStr() returns the location of the module as a URI string.
.getPackages() returns the packages in the module as a List<String>. (Does not include non-package directories.)
.isSystemModule() returns true if this is a system module (i.e. java.*, jdk.*, javax.*, oracle.*, etc.)
.open() returns a ModuleReaderProxy that can be used to read from the module. Make sure you call .close() on the ModuleReaderProxy when you have finished.
.getReference() gets the wrapped JPMS ModuleReference.
.getLayer() gets the ModuleLayer of the module.
.getDescriptor() gets the ModuleDescriptor for the module.
ModuleReaderProxy
Holds a reference to a module reader. This is an introspection-based wrapper for JPMS' ModuleReader class. This wrapper gives backwards compatibility with JDK 7 and JDK 8.
.list() returns the resource paths in the module as a List<String>.
.open(String path) opens the resource with the given path as an InputStream. Make sure you call close() on this InputStream when you have finished.
.read(String path) opens the resource with the given path as a ByteBuffer. Make sure you call .release(byteBuffer)when you have finished.
.release(ByteBuffer byteBuffer) releases a ByteBuffer after it was allocated by calling .read(String path).
.close() closes the ModuleReader. Make sure you call this method when you have finished with the ModuleReaderProxy.