Libraryless. Click here for Pure Java version (3211L/18K).
static void zip2dir(File inZip, File/S outDir) { zip2dir(inZip, outDir, ""); } static void zip2dir(File inZip, File/S outDir, S prefix) ctex { if (prefix.length() != 0 && !prefix.endsWith("/")) prefix += "/"; temp ZipFile zipFile = new ZipFile(inZip); Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); if (entry.isDirectory()) continue; // We care about files only, really. Directories are made on the fly anyway. if (!entry.getName().startsWith(prefix)) continue; File outFile = new File(outDir, entry.getName()); print("Unzipping " + entry.getName() + " to " + outFile.getAbsolutePath()); stream2file(zipFile.getInputStream(entry), outFile); } }
Began life as a copy of #1001173
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001335 |
Snippet name: | zip2dir |
Eternal ID of this version: | #1001335/4 |
Text MD5: | 62d4b7420a26c4691a6bd719a35c6001 |
Transpilation MD5: | b3bb3bc38346875cc1b14fd808def64f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-29 23:50:40 |
Source code size: | 809 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 802 / 1054 |
Version history: | 3 change(s) |
Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1013790 - unzip - synonym of zip2dir #1025022 - zip2dir_withPredicate #3000382 - Answer for ferdie (>> t = 1, f = 0) |