private void getEntry(ZipInputStream stream, String name) throws IOException { for (ZipEntry nextEntry = stream.getNextEntry(); nextEntry != null; nextEntry = stream.getNextEntry()) { if (name.equals(nextEntry.getName())) { return; } } stream.reset(); for (ZipEntry nextEntry = stream.getNextEntry(); nextEntry != null; nextEntry = stream.getNextEntry()) { if (name.equals(nextEntry.getName())) { return; } } throw new IllegalStateException("entry not found"); }