Uses 578K of libraries. Click here for Pure Java version (2207L/14K).
!include once #1024944 // Apache Commons Compress import org.apache.commons.compress.archivers.tar.*; svoid zip2tar_withPredicate(File inZip, File outTar, IF1<S, Bool> predicate) ctex { temp FileOutputStream out = newFileOutputStream(outTar); zip2tar_withPredicate(inZip, out, predicate); } svoid zip2tar_withPredicate(File inZip, OutputStream out, IF1<S, Bool> predicate) { zip2tar_withPredicate(inZip, bufferedOutputStream(out), predicate); } svoid zip2tar_withPredicate(File inZip, BufferedOutputStream out, IF1<S, Bool> predicate) ctex { TarArchiveOutputStream tarOut = new(out); tarOut.setLongFileMode(tarOut.LONGFILE_GNU); zip2tar_withPredicate(inZip, tarOut, predicate); out.flush(); } svoid zip2tar_withPredicate(File inZip, TarArchiveOutputStream outTar, IF1<S, Bool> predicate) ctex { ZipFile zipFile = new ZipFile(inZip); Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); continue unless predicate.get(entry.getName()); TarArchiveEntry te = new(entry.getName()); te.setModTime(entry.getTime()); te.setSize(entry.getSize()); outTar.putArchiveEntry(te); InputStream fin = zipFile.getInputStream(entry); copyStream(fin, outTar); fin.close(); } outTar.flush(); zipFile.close(); }
Began life as a copy of #1024945
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: | #1024958 |
Snippet name: | zip2tar_withPredicate |
Eternal ID of this version: | #1024958/1 |
Text MD5: | 7aad144cf2b7ce1ab279998fa657e5ab |
Transpilation MD5: | babcd9da8d36048ecf4db185d74a6e5c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-31 16:32:25 |
Source code size: | 1378 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 194 / 276 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |