Libraryless. Click here for Pure Java version (4686L/26K).
1 | static int zip2zip_withPredicate(File inZip, ZipOutputStream outZip, IF1<S, Bool> predicate) ctex { |
2 | temp ZipFile zipFile = new ZipFile(inZip); |
3 | Enumeration entries = zipFile.entries(); |
4 | int n = 0; |
5 | while (entries.hasMoreElements()) { |
6 | ZipEntry entry = (ZipEntry) entries.nextElement(); |
7 | continue unless predicate.get(entry.getName()); |
8 | ++n; |
9 | outZip.putNextEntry(new ZipEntry(entry.getName())); |
10 | |
11 | InputStream fin = zipFile.getInputStream(entry); |
12 | copyStream(fin, outZip); |
13 | fin.close(); |
14 | } |
15 | ret n; |
16 | } |
17 | |
18 | static int zip2zip_withPredicate(File inZip, File outZip, IF1<S, Bool> predicate) { |
19 | temp ZipOutputStream outStream = zipOutputStream(outZip); |
20 | ret zip2zip_withPredicate(inZip, outStream, predicate); |
21 | } |
Began life as a copy of #1001173
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024957 |
Snippet name: | zip2zip_withPredicate |
Eternal ID of this version: | #1024957/4 |
Text MD5: | 1c3ebc0f8ef6c7de65c2e4ad3078f51d |
Transpilation MD5: | b7fa1e1b3842f226fe5ec65325a24bb7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-20 16:52:42 |
Source code size: | 755 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 173 / 268 |
Version history: | 3 change(s) |
Referenced in: | [show references] |