Libraryless. Click here for Pure Java version (4557L/26K).
1 | static void zip2zip_collectFiles(File inZip, ZipOutputStream outZip, Set<S> filesWritten, IPred<S> predicate default name -> true) ctex { |
2 | ZipFile zipFile = new ZipFile(inZip); |
3 | try { |
4 | Enumeration entries = zipFile.entries(); |
5 | while (entries.hasMoreElements()) { |
6 | ZipEntry entry = (ZipEntry) entries.nextElement(); |
7 | if (entry.isDirectory()) continue; |
8 | S name = entry.getName(); |
9 | |
10 | if (!predicate.get(name)) continue; |
11 | if (!filesWritten.add(name)) continue; |
12 | |
13 | outZip.putNextEntry(new ZipEntry(name)); |
14 | copyStreamAndCloseInput(zipFile.getInputStream(entry), outZip); |
15 | } |
16 | } finally { |
17 | zipFile.close(); |
18 | } |
19 | } |
Began life as a copy of #1019060
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033332 |
Snippet name: | zip2zip_collectFiles - collects files written |
Eternal ID of this version: | #1033332/4 |
Text MD5: | 41fc7fa1d91a5d7992ceb4b63b99a9ee |
Transpilation MD5: | 0c10e1e463cfbd839d80badc6cc04f3e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-28 22:34:37 |
Source code size: | 683 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 190 / 253 |
Version history: | 3 change(s) |
Referenced in: | [show references] |