Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data


< > BotCompany Repo | #1024957 - zip2zip_withPredicate

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2639L/17K).

static void zip2zip_withPredicate(File inZip, ZipOutputStream outZip, 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());
    outZip.putNextEntry(new ZipEntry(entry.getName()));
    InputStream fin = zipFile.getInputStream(entry);
    copyStream(fin, outZip);

svoid zip2zip_withPredicate(File inZip, File outZip, IF1<S, Bool> predicate) {
  temp ZipOutputStream outStream = zipOutputStream(outZip);
  zip2zip_withPredicate(inZip, outStream, predicate);

Author comment

Began life as a copy of #1001173

download  show line numbers  debug dex   

Travelled to 5 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz

No comments. add comment

Snippet ID: #1024957
Snippet name: zip2zip_withPredicate
Eternal ID of this version: #1024957/3
Text MD5: add5d6e37e45edbf37c9ad590ad9f5da
Transpilation MD5: 83f71e972bacd0b68ae4648e58666ad5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-27 15:45:39
Source code size: 728 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 52 / 90
Version history: 2 change(s)
Referenced in: [show references]

Formerly at &