Search Java Code Snippets

  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.

Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of

    private void removeEntriesFoundInZipFile(final File result, final Map<String, byte[]> entries) throws IOException {

final ZipFile zf = new ZipFile(result);

final Enumeration<ZipArchiveEntry> entriesInPhysicalOrder = zf.getEntriesInPhysicalOrder();

while (entriesInPhysicalOrder.hasMoreElements()){

final ZipArchiveEntry zipArchiveEntry = entriesInPhysicalOrder.nextElement();

final InputStream inputStream = zf.getInputStream(zipArchiveEntry);

final byte[] actual = IOUtils.toByteArray(inputStream);

final byte[] expected = entries.remove(zipArchiveEntry.getName());

assertArrayEquals( "For " + zipArchiveEntry.getName(), expected, actual);




   Like      Feedback

Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner

comments powered by Disqus