Code example for ZipInputStream

Methods: closeEntry, getNextEntry

0
     * @tests java.util.zip.ZipOutputStream#finish() 
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "ZipException can not be checked.", 
        method = "finish", 
        args = {} 
    ) 
    public void test_finish() throws Exception { 
        ZipEntry ze = new ZipEntry("test");
        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();