Proposal: jar option to disable compression for selected file extensions
Lance Andersen
lance.andersen at oracle.com
Tue Dec 17 18:01:44 UTC 2024
Hi Eirik,
I think this proposal has merit.
Outside of info-zip, are you aware of any other zip tool that does something similar? 7zip, WinZip and compress do not appear to offer similar functionality.
On Dec 16, 2024, at 6:38 AM, Eirik Bjørsnøs <eirbjo at gmail.com> wrote:
Hi,
I would like to socialize the idea of adding a new option to the jar tool to disable ZIP compression for selected file extensions.
The jar tool currently supports disabling ZIP compression altogether for an archive using the -0 --no-compress options.
However, different file types have different compression characteristics. Already compressed files such as JPEG, PNG have little to gain by deflate compression, and the compression and decompression of such files is mostly a waste of effort. The same is true for archive formats such as ZIP, JAR, GZ etc.
I propose that we add a new option, tentatively named "--no-compress-ext", which would take a colon-separated list of file extensions to disable ZIP compression for:
jar --create --file archive.jar --no-compress-ext=.jpg:.png:.gz -C dir .
This would work similarly to the zip -n option, see zip --help:
-n don't compress these suffixes
In context, the jar --help command could look something like this:
-0, --no-compress Store only; use no ZIP compression
--no-compress-ext=EXT Disable compression for selected file extensions,
e.g. "--no-compress-ext=.zip:.jar:.jpg:.png"
I specifically do not suggest that we should define any kind of default for this option. This should be entirely up to the user.
Feedback on this proposal is welcome. (I have a draft implementation around, but let's focus on the merits of the proposal before we dive into any code)
Eirik.
[oracle_sig_logo.gif]
Lance Andersen | Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20241217/5c8f5726/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oracle_sig_logo.gif
Type: image/gif
Size: 658 bytes
Desc: oracle_sig_logo.gif
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20241217/5c8f5726/oracle_sig_logo-0001.gif>
More information about the core-libs-dev
mailing list