Iterate through source for not removed entries with a given callback

@param zipEntryCallback callback to execute on entries or their info.
171038
private void iterateExistingExceptRemoved(ZipEntryOrInfoAdapter zipEntryCallback) {
    if (src == null) {
      // if we don't have source specified, then we have nothing to iterate.
      return;
    }
    final Set<String> removedDirs = ZipUtil.filterDirEntries(src, removedEntries);

    ZipFile zf = null;
    try {
      zf = getZipFile();

      // manage existing entries
      Enumeration<? extends ZipEntry> en = zf.entries();
      while (en.hasMoreElements()) {
        ZipEntry entry = en.nextElement();
        String entryName = entry.getName();
        if (removedEntries.contains(entryName) || isEntryInDir(removedDirs, entryName)) {
          // removed entries are
          continue;
        }

        if (nameMapper != null) {
          String mappedName = nameMapper.map(entry.getName());
          if (mappedName == null) {
            continue; // we should ignore this entry
          }
          else if (!mappedName.equals(entry.getName())) {
            // if name is different, do nothing
            entry = ZipEntryUtil.copy(entry, mappedName);
          }
        }

        InputStream is = zf.getInputStream(entry);
        try {
          zipEntryCallback.process(is, entry);
        }
        catch (ZipBreakException ex) {
          break;
        }
        finally {
          IOUtils.closeQuietly(is);
        }
      }
    }
    catch (IOException e) {
      ZipExceptionUtil.rethrow(e);
    }
    finally {
      ZipUtil.closeQuietly(zf);
    }
  }
1215917
private boolean isZip(JarEntry entry) throws IOException {
        try (InputStream entryInputStream = sourceFatJar.getInputStream(entry)) {
            try (ZipInputStream zipInputStream = new ZipInputStream(entryInputStream)) {
                ZipEntry ze = zipInputStream.getNextEntry();
                if (ze == null) {
                    return false;
                }
                return true;
            }
        }
    }
1242446
public void readEntries(BufferedReader lineReader, ErrorCallBack errorCallBack) throws IOException {
		final MagicEntry[] levelParents = new MagicEntry[MAX_LEVELS];
		MagicEntry previousEntry = null;
		while (true) {
			String line = lineReader.readLine();
			if (line == null) {
				break;
			}
			// skip blanks and comments
			if (line.length() == 0 || line.charAt(0) == '#') {
				continue;
			}

			MagicEntry entry;
			try {
				// we need the previous entry because of mime-type, etc. which augment the previous line
				entry = MagicEntryParser.parseLine(previousEntry, line, errorCallBack);
				if (entry == null) {
					continue;
				}
			} catch (IllegalArgumentException e) {
				if (errorCallBack != null) {
					errorCallBack.error(line, e.getMessage(), e);
				}
				continue;
			}

			int level = entry.getLevel();
			if (previousEntry == null && level != 0) {
				if (errorCallBack != null) {
					errorCallBack.error(line, "first entry of the file but the level " + level + " should be 0", null);
				}
				continue;
			}

			if (level == 0) {
				// top level entry
				entryList.add(entry);
			} else if (levelParents[level - 1] == null) {
				if (errorCallBack != null) {
					errorCallBack.error(line,
							"entry has level " + level + " but no parent entry with level " + (level - 1), null);
				}
				continue;
			} else {
				// we are a child of the one above us
				levelParents[level - 1].addChild(entry);
			}
			levelParents[level] = entry;
			previousEntry = entry;
		}
	}
309274
public void addFile(String zipEntry, String filename) throws IOException {
		addFile(zipEntry, new File(filename));
	}
224431
protected void loadEntry(AsyncCallback<CmsClientSitemapEntry> callback) {

        CmsClientSitemapEntry entry = getEntry();
        if ((entry == null) && (m_sitePath != null)) {
            m_controller.loadPath(m_sitePath, true, callback);
        } else {
            callback.onSuccess(entry);
        }
    }
965530
function(entry) {
        var result;
        if (entry) {
            if (successCallback) {
                // create appropriate Entry object
                result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath);
                successCallback(result);
            }
        }
        else {
            // no Entry object returned
            fail(FileError.NOT_FOUND_ERR);
        }
    }
667194
public static InputStream getResourceInputStreamForZip(ZipFile zipFile,
            String entryName) {
        try {
            return zipFile.getInputStream(zipFile.getEntry(entryName));
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "newZipFile", zipFile, entryName);
        }
    }
1251215
public static boolean replaceEntry(File zip, String path, File file, File destZip) {
    return replaceEntry(zip, new FileSource(path, file), destZip);
  }
18811
public static boolean containsEntry(File zip, String name) {
    ZipFile zf = null;
    try {
      zf = new ZipFile(zip);
      return zf.getEntry(name) != null;
    }
    catch (IOException e) {
      throw ZipExceptionUtil.rethrow(e);
    }
    finally {
      closeQuietly(zf);
    }
  }
119410
public static void addOrReplaceEntries(final File zip, final ZipEntrySource[] entries) {
    operateInPlace(zip, new InPlaceAction() {
      public boolean act(File tmpFile) {
        addOrReplaceEntries(zip, entries, tmpFile);
        return true;
      }
    });
  }
1107042
public void updateEntry(CmsUUID entryId, final AsyncCallback<Void> callback) {

        getChildren(
            entryId,
            CmsSitemapTreeItem.getItemById(entryId).isOpen(),
            new AsyncCallback<CmsClientSitemapEntry>() {

                public void onFailure(Throwable caught) {

                    // nothing to do

                }

                public void onSuccess(CmsClientSitemapEntry result) {

                    if (callback != null) {
                        callback.onSuccess(null);
                    }
                }
            });
    }
549353
public static String entryAsString(final ZipFile file, ZipEntry entry, Charset charset)
      throws IOException {
    return new ZipEntryByteSource(file, entry).asCharSource(charset).read();
  }
656767
public static void addEntries(File zip, ZipEntrySource[] entries, OutputStream destOut) {
    if (log.isDebugEnabled()) {
      log.debug("Copying '" + zip + "' to a stream and adding " + Arrays.asList(entries) + ".");
    }

    ZipOutputStream out = null;
    try {
      out = new ZipOutputStream(destOut);
      copyEntries(zip, out);
      for (int i = 0; i < entries.length; i++) {
        addEntry(entries[i], out);
      }
      out.finish();
    }
    catch (IOException e) {
      ZipExceptionUtil.rethrow(e);
    }
  }
993399
void fireEntryLeave(AsteriskQueueEntryImpl entry)
    {
        synchronized (listeners)
        {
            for (AsteriskQueueListener listener : listeners)
            {
                try
                {
                    listener.onEntryLeave(entry);
                }
                catch (Exception e)
                {
                    logger.warn("Exception in onEntryLeave()", e);
                }
            }
        }
    }
992313
public static void removeEntry(final File zip, final String path) {
    operateInPlace(zip, new InPlaceAction() {
      public boolean act(File tmpFile) {
        removeEntry(zip, path, tmpFile);
        return true;
      }
    });
  }
293710
private void addEntries(final FileSystem zipFs) throws IOException {

        for (Map.Entry<String, URL> entry : contentMap.entrySet()) {
            final Path pathToFile = zipFs.getPath(entry.getKey());
            final URL resource = entry.getValue();
            addResource(pathToFile, resource);
        }
    }
561755
private void readEnd(ZipEntry e) throws IOException {
        int n = inf.getRemaining();
        if (n > 0) {
            ((PushbackInputStream)in).unread(buf, len - n, n);
        }
        if ((flag & 8) == 8) {
            /* "Data Descriptor" present */
            if (inf.getBytesWritten() > ZIP64_MAGICVAL ||
                inf.getBytesRead() > ZIP64_MAGICVAL) {
                // ZIP64 format
                readFully(tmpbuf, 0, ZIP64_EXTHDR);
                long sig = get32(tmpbuf, 0);
                if (sig != EXTSIG) { // no EXTSIG present
                    e.crc = sig;
                    e.csize = get64(tmpbuf, ZIP64_EXTSIZ - ZIP64_EXTCRC);
                    e.size = get64(tmpbuf, ZIP64_EXTLEN - ZIP64_EXTCRC);
                    ((PushbackInputStream)in).unread(
                        tmpbuf, ZIP64_EXTHDR - ZIP64_EXTCRC - 1, ZIP64_EXTCRC);
                } else {
                    e.crc = get32(tmpbuf, ZIP64_EXTCRC);
                    e.csize = get64(tmpbuf, ZIP64_EXTSIZ);
                    e.size = get64(tmpbuf, ZIP64_EXTLEN);
                }
            } else {
                readFully(tmpbuf, 0, EXTHDR);
                long sig = get32(tmpbuf, 0);
                if (sig != EXTSIG) { // no EXTSIG present
                    e.crc = sig;
                    e.csize = get32(tmpbuf, EXTSIZ - EXTCRC);
                    e.size = get32(tmpbuf, EXTLEN - EXTCRC);
                    ((PushbackInputStream)in).unread(
                                               tmpbuf, EXTHDR - EXTCRC - 1, EXTCRC);
                } else {
                    e.crc = get32(tmpbuf, EXTCRC);
                    e.csize = get32(tmpbuf, EXTSIZ);
                    e.size = get32(tmpbuf, EXTLEN);
                }
            }
        }
        if (e.size != inf.getBytesWritten()) {
            throw new ZipException(
                "invalid entry size (expected " + e.size +
                " but got " + inf.getBytesWritten() + " bytes)");
        }
        if (e.csize != inf.getBytesRead()) {
            throw new ZipException(
                "invalid entry compressed size (expected " + e.csize +
                " but got " + inf.getBytesRead() + " bytes)");
        }
        if (e.crc != crc.getValue()) {
            throw new ZipException(
                "invalid entry CRC (expected 0x" + Long.toHexString(e.crc) +
                " but got 0x" + Long.toHexString(crc.getValue()) + ")");
        }
    }