sclass Zip2Zip_b { // must set File inZip; ZipOutputStream outZip; new Set filesWritten; // optional IPred predicate; *(File *inZip, ZipOutputStream *outZip, Set *filesWritten) {} *(ZipOutputStream *outZip) {} run { 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 != null && !predicate.get(name)) continue; if (!filesWritten.add(name)) continue; modifyZipEntry(entry); outZip.putNextEntry(entry); copyStreamAndCloseInput(zipFile.getInputStream(entry), outZip); } } finally { zipFile.close(); } } swappable void modifyZipEntry(ZipEntry e) {} }