1 | static new ThreadLocal<Bool> smartZipCompressionLevel_on; |
2 | |
3 | static AutoCloseable smartZipCompressionLevel(ZipOutputStream zip, File f) { |
4 | ret smartZipCompressionLevel(zip, fileName(f)); |
5 | } |
6 | |
7 | static AutoCloseable smartZipCompressionLevel(final ZipOutputStream zip, S fileName) { |
8 | if (!isTrue(smartZipCompressionLevel_on!)) null; |
9 | int level = Deflater.DEFAULT_COMPRESSION; |
10 | if (isImageFileName(fileName) || eqicOneOf(fileExtension(fileName), ".zip", ".jar", ".gz", ".bin")) // assume .bin is a jar snippet or some such |
11 | level = Deflater.NO_COMPRESSION; |
12 | zip.setLevel(level); |
13 | ret autoCloseable { zip.setLevel(Deflater.DEFAULT_COMPRESSION); }; |
14 | } |
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: | 338 / 395 |
Version history: | 6 change(s) |
Referenced in: | [show references] |