Code example for DeflaterInputStream

Methods: close, read

0
    } 
 
    public void testReadExceptions() throws IOException { 
        byte[] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
        byte[] buffer = new byte[8];
        InputStream in = new DeflaterInputStream(new ByteArrayInputStream(data));
        try { 
            in.read(buffer, 0, 10);
            fail();
        } catch (IndexOutOfBoundsException expected) {
        } 
        try { 
            in.read(null, 0, 5);
            fail();
        } catch (NullPointerException expected) {
        } 
        try { 
            in.read(buffer, -1, 5);
            fail();
        } catch (IndexOutOfBoundsException expected) {
        } 
        in.close();
        try { 
            in.read(buffer, 0, 5);
            fail();
        } catch (IOException expected) {
        } 
    } 
}