code: private static void copyEntries(File zip, final ZipOutputStream out) {
      // this one doesn't call copyEntries with ignoredEntries, because that has poorer performance
      final Set<String> names = new HashSet<String>();
      iterate(zip, new ZipEntryCallback() {
        public void process(InputStream in, ZipEntry zipEntry) throws IOException {
          String entryName = zipEntry.getName();
          if (names.add(entryName)) {
            ZipEntryUtil.copyEntry(zipEntry, in, out);
          }
          else if (log.isDebugEnabled()) {
            log.debug("Duplicate entry: {}", entryName);
          }
        }
      });
    }
docs: Copies all entries from one ZIP file to another.
  
  @param zip
  source ZIP file.
  @param out
  target ZIP stream.