Reads the binary form of a module declaration from a byte buffer as a module descriptor.
If the descriptor encoded in the byte buffer does not indicate a set of packages in the module then the packageFinder
will be invoked. The set of packages that the packageFinder
returns must include all the packages that the module exports, opens, as well as the packages of the service implementations that the module provides, and the package of the main class (if the module has a main class). If the packageFinder
throws an UncheckedIOException
then IOException
cause will be re-thrown.
The module descriptor is read from the buffer stating at index p
, where p
is the buffer's position
when this method is invoked. Upon return the buffer's position will be equal to p + n
where n
is the number of bytes read from the buffer.
If there are bytes following the module descriptor then it is implementation specific as to whether those bytes are read, ignored, or reported as an InvalidModuleDescriptorException
. If this method fails with an InvalidModuleDescriptorException
then it may do so after some, but not all, bytes have been read.