RFR: 8303923: ZipOutStream::putEntry should include an apiNote to indicate that the STORED compression method should be used when writing directory entries [v3]

Eirik Bjorsnos duke at openjdk.org
Thu Mar 23 07:19:44 UTC 2023


On Wed, 22 Mar 2023 23:45:43 GMT, jmehrens <duke at openjdk.org> wrote:

> The example code works without setting the compressed size on the entry?

Yes, this is the minimal code required and is also how the `jar` tool does it. 

The current behaviour does feel a bit underspecified though.  In the `ZipEntry` and `ZipOutputStream` documentation, `getCompressedSize` documents that: 'In the case of a stored entry, the compressed size will be the same as the uncompressed size of the entry.'

Perhaps a similar note should be addded to `ZipEntry.setCompressedSize`, documenting that this method need not be called for STORED entries.

@LanceAndersen what do you think?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/12899#issuecomment-1480705313


More information about the core-libs-dev mailing list