Pull parser for jmod packages

Paul Sandoz paul.sandoz at oracle.com
Fri May 25 07:59:59 PDT 2012


On May 25, 2012, at 3:47 PM, Sean Mullan wrote:

> On 5/25/12 9:10 AM, Chris Hegarty wrote:
>>> I also took a quick look at the writing side of this. It may be
>>> advantageous to keep that in mind for the signing case you mention. At the
>>> moment ModuleFileWriter also seems to be bound to a certain file-based
>>> layout for input. But, i think it should be possible to round trip by
>>> hooking up the pull parser/reader to the writer, then signing becomes an
>>> man-in-the-middle of that process, and ideally the Signer should only have
>>> to deal with encoding details of the signing section.
> 
> Keep in mind that the current signed module file format is optimized for
> streaming as you read, but not as you write.

Yes, entirely reasonable since there will be many more readers than writers.


> The entire file has to be written
> out and the hashes calculated/read in order to calculate the signature, thus the
> Signer basically does a two-pass write in order to do that, once to a temporary
> file, and the second time to the signed jmod.
> 

My guess is that If section encoders, that are delayed computations, are added to a writer and are enacted on committing it should be possible to work in an apparent streaming manner (with IIUC the special knowledge that the signature section is not included in the global hash calculation when writing and reading).

Paul.


More information about the jigsaw-dev mailing list