On Sun, 12 May 2024 02:48:31 GMT, xiaotaonan <d...@openjdk.org> wrote:

> Add API to access ZipEntry.extraAttributes

For example, with a quick check, you can find that this field itself is not a 
good candidate for direct setter exposure:
1. For context, this is part of [the central directory file 
header](https://en.wikipedia.org/wiki/ZIP_(file_format)#Central_directory_file_header)
 for each Zip entry.
2. This is read from bytes 40-41 (most significant 2 bytes of "External file 
attributes") if the byte 5 is 3 (most significant byte of "Version made by"); 
it's stored in the same way.
3. Besides valid unsigned short values, this field also has a value of `-1` (or 
all negative values) indicating this field is absent.

Thus, a direct setter doesn't indicate the restriction that the field is 2-byte 
and is optional.

A getter might be fine, but given there are other ZIP fields that we don't 
expose (such as bytes 36-37, 38-41) it's dubious whether such exposure would be 
needed at all. After all, we should continue the discussion on 
core-libs-dev@openjdk.org.

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

PR Comment: https://git.openjdk.org/jdk/pull/19204#issuecomment-2106251411

Reply via email to