Share

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 org.apache.commons.compress.archivers.zip.ZipFile

    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);

}

zf.close();

}


   Like      Feedback      org.apache.commons.compress.archivers.zip.ZipFile



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



comments powered by Disqus