Search Java Code Snippets


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





#Java - Code Snippets for '#Org.apache.commons.compress.archivers.zip.ZipArchiveInputStream' - 1 code snippet(s) found

 Sample 1. Code Sample / Example / Snippet of org.apache.commons.compress.archivers.zip.ZipArchiveInputStream

    private void testZipStreamWithImplodeCompression(final String filename, final String entryName) throws IOException {

final ZipArchiveInputStream zin = new ZipArchiveInputStream(new FileInputStream(new File(filename)));

final ZipArchiveEntry entry = zin.getNextZipEntry();

assertEquals("entry name", entryName, entry.getName());

assertTrue("entry can't be read", zin.canReadEntryData(entry));

assertEquals("method", ZipMethod.IMPLODING.getCode(), entry.getMethod());



final InputStream bio = new BoundedInputStream(zin, entry.getSize());



final ByteArrayOutputStream bout = new ByteArrayOutputStream();

final CheckedOutputStream out = new CheckedOutputStream(bout, new CRC32());

IOUtils.copy(bio, out);



out.flush();



assertEquals("CRC32", entry.getCrc(), out.getChecksum().getValue());

}


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



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