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