Provides access to the content of a module.
A module reader is intended for cases where access to the resources in a module is required, regardless of whether the module has been loaded. A framework that scans a collection of packaged modules on the file system, for example, may use a module reader to access a specific resource in each module. A module reader is also intended to be used by
ClassLoader implementations that load classes and resources from modules.
A Resource in a module is identified by a name that is a '
/'-separated path string. For example, module
java.base may have a resource "
java/lang/Object.class" that, by convention, is the class file for
ModuleReader is open upon creation and is closed by invoking the
close method. Failure to close a module reader may result in a resource leak. The
try-with-resources statement provides a useful construct to ensure that module readers are closed.
ModuleReader implementation may require permissions to access resources in the module. Consequently the
list methods may throw
SecurityException if access is denied by the security manager.