Given the nature of the JarInputStream (it's possible it's a non-seekable stream), there is no practically possible solution to locate/read the manifest without consuming the stream data, if the manifest is not the first/second entry (which is currently the assumption of JarInputStream spec/implementation, if the manifest entry is required/seeked) in the stream. Closed as "will not fix" for now.
JarInputStream has to be able to work on a non-seekable stream,
so implementing a method to get the Manifest is in general, impossible,
at least if the stream has not been exhaustively read.
The way that JarInputStream handles this is by assuming that a manifest,
if present, must occur at the beginning of the jar file,
preceded only by an entry for the META-INF directory itself.
It might be a good idea to set the manifest if it is encountered while
scanning the jar file, but in any case, because the requested functionality
cannot be made to work perfectly, the docs should be updated to reflect
the lowered expectations that users should have.