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.ZipArchiveOutputStream

    public void testCompressionMethod() throws Exception {

final ZipArchiveOutputStream zos =

new ZipArchiveOutputStream(new ByteArrayOutputStream());

final ZipArchiveEntry entry = new ZipArchiveEntry("foo");

assertEquals(-1, entry.getMethod());

assertFalse(zos.canWriteEntryData(entry));



entry.setMethod(ZipEntry.STORED);

assertEquals(ZipEntry.STORED, entry.getMethod());

assertTrue(zos.canWriteEntryData(entry));



entry.setMethod(ZipEntry.DEFLATED);

assertEquals(ZipEntry.DEFLATED, entry.getMethod());

assertTrue(zos.canWriteEntryData(entry));



entry.setMethod(6);

assertEquals(6, entry.getMethod());

assertFalse(zos.canWriteEntryData(entry));

zos.close();

}


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



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