static new ThreadLocal<Bool> smartZipCompressionLevel_on; static AutoCloseable smartZipCompressionLevel(ZipOutputStream zip, File f) { ret smartZipCompressionLevel(zip, fileName(f)); } static AutoCloseable smartZipCompressionLevel(final ZipOutputStream zip, S fileName) { if (!isTrue(smartZipCompressionLevel_on!)) null; int level = Deflater.DEFAULT_COMPRESSION; if (isImageFileName(fileName) || eqicOneOf(fileExtension(fileName), ".zip", ".jar", ".gz", ".bin")) // assume .bin is a jar snippet or some such level = Deflater.NO_COMPRESSION; zip.setLevel(level); ret autoCloseable { zip.setLevel(Deflater.DEFAULT_COMPRESSION); }; }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022701 |
Snippet name: | smartZipCompressionLevel |
Eternal ID of this version: | #1022701/7 |
Text MD5: | 17ab447e28d2fded98214171a911b942 |
Author: | stefan |
Category: | javax / io |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-05-15 15:13:01 |
Source code size: | 661 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 337 / 393 |
Version history: | 6 change(s) |
Referenced in: | [show references] |