static void zip2zip_collectFiles(File inZip, ZipOutputStream outZip, Set filesWritten, IPred predicate default name -> true) ctex { ZipFile zipFile = new ZipFile(inZip); try { Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); if (entry.isDirectory()) continue; S name = entry.getName(); if (!predicate.get(name)) continue; if (!filesWritten.add(name)) continue; outZip.putNextEntry(new ZipEntry(name)); copyStreamAndCloseInput(zipFile.getInputStream(entry), outZip); } } finally { zipFile.close(); } }