Code example for Deflater

Methods: deflate, finish, getBytesWritten, getTotalIn, getTotalOut, setInput

0
            boundDefl.setLevel(-2);
            fail("IllegalArgumentException not thrown when setting level to a number < 0.");
        } catch (IllegalArgumentException e) {
        } 
        try { 
            Deflater boundDefl = new Deflater();
            boundDefl.setLevel(10);
            fail("IllegalArgumentException not thrown when setting level to a number > 9.");
        } catch (IllegalArgumentException e) {
        } 
    } 
 
    private void helper_end_test(Deflater defl, String desc) {
        // Help tests for test_end() and test_reset(). 
        byte byteArray[] = {5, 2, 3, 7, 8};
 
        // Methods where we expect IllegalStateException or NullPointerException 
        // to be thrown 
        try { 
            defl.getTotalOut();
            fail("defl.getTotalOut() can still be used after " + desc
                    + " is called in test_" + desc);
        } catch (IllegalStateException e) {
        } catch (NullPointerException e) {
        } 
        try {