Code example for DeflaterInputStream

Methods: available, close, read

0
    /** 
     * @tests DeflaterInputStream#close() 
     */ 
    public void testClose() throws IOException { 
        byte[] buf = new byte[1024];
        DeflaterInputStream dis = new DeflaterInputStream(is);
        assertEquals(1, dis.available());
        dis.close();
        try { 
            dis.available();
            fail("should throw IOException");
        } catch (IOException e) {
            // expected 
        } 
        try { 
            dis.read(buf, 0, 1024);
            fail("should throw IOException");
        } catch (IOException e) {
            // expected 
        } 
        // can close after close 
        dis.close();
    } 
 
    /** 
     * @tests DeflaterInputStream#mark() 
     */