code: public static boolean replaceEntries(File zip, ZipEntrySource[] entries, File destZip) {
      if (log.isDebugEnabled()) {
        log.debug("Copying '" + zip + "' to '" + destZip + "' and replacing entries " + Arrays.asList(entries) + ".");
      }
  
      final Map<String, ZipEntrySource> entryByPath = entriesByPath(entries);
      final int entryCount = entryByPath.size();
      try {
        final ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destZip)));
        try {
          final Set<String> names = new HashSet<String>();
          iterate(zip, new ZipEntryCallback() {
            public void process(InputStream in, ZipEntry zipEntry) throws IOException {
              if (names.add(zipEntry.getName())) {
                ZipEntrySource entry = (ZipEntrySource) entryByPath.remove(zipEntry.getName());
                if (entry != null) {
                  addEntry(entry, out);
                }
                else {
                  ZipEntryUtil.copyEntry(zipEntry, in, out);
                }
              }
              else if (log.isDebugEnabled()) {
                log.debug("Duplicate entry: {}", zipEntry.getName());
              }
            }
          });
        }
        finally {
          IOUtils.closeQuietly(out);
        }
      }
      catch (IOException e) {
        ZipExceptionUtil.rethrow(e);
      }
      return entryByPath.size() < entryCount;
    }
docs: Copies an existing ZIP file and replaces the given entries in it.
  
  @param zip
  an existing ZIP file (only read).
  @param entries
  new ZIP entries to be replaced with.
  @param destZip
  new ZIP file created.
  @return <code>true</code> if at least one entry was replaced.