Code example for ZipOutputStream

Methods: closefinishputNextEntry

0
        zos.putNextEntry(ze);
        zos.write("Hello World".getBytes());
        zos.finish();
        assertEquals("Finish failed to closeCurrentEntry", 11, ze.getSize());
 
        ZipOutputStream zos = new ZipOutputStream(new ByteArrayOutputStream());
        zos.putNextEntry(new ZipEntry("myFile"));
        zos.finish();
        zos.close();
        try { 
            zos.finish();
            fail("Assert 0: Expected IOException");
        } catch (IOException e) {
            // Expected 
        } 
    } 
 
    /** 
     * @tests java.util.zip.ZipOutputStream#putNextEntry(java.util.zip.ZipEntry) 
     */ 
    public void test_putNextEntryLjava_util_zip_ZipEntry() throws IOException {