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

18
LINES

< > BotCompany Repo | #1019060 // zip2zip_exceptManifest2 - collects files written

JavaX fragment (include)

static void zip2zip_exceptManifest2(File inZip, ZipOutputStream outZip, Set<S> filesWritten) ctex {
  ZipFile zipFile = new ZipFile(inZip);
  try {
    Enumeration entries = zipFile.entries();
    while (entries.hasMoreElements()) {
      ZipEntry entry = (ZipEntry) entries.nextElement();
      if (entry.isDirectory()) continue;
      //if (eq(entry.getName(), "META-INF/MANIFEST.MF")) continue;
      if (startsWith(entry.getName(), "META-INF/")) continue;
      
      if (!filesWritten.add(entry.getName())) continue;
      outZip.putNextEntry(new ZipEntry(entry.getName()));
      copyStreamAndCloseInput(zipFile.getInputStream(entry), outZip);
    }
  } finally {
    zipFile.close();
  }
}

Author comment

Began life as a copy of #1011503

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019060
Snippet name: zip2zip_exceptManifest2 - collects files written
Eternal ID of this version: #1019060/3
Text MD5: fa97a14fa6766a8c0f03f8af869c511c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-25 15:16:22
Source code size: 714 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 366 / 403
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1019061 - zip2zip_exceptManifest3 - also uses a general file filter
#1033332 - zip2zip_collectFiles - collects files written