Code example for Inflater

Methods: end, inflate, setInput

0
                72, -50, -49, 43, 73, -52, -52, 43, 86, 72, 2, 10, 34, 99, 
                -123, -60, -68, 20, -80, 32, 0, -101, -69, 17, 84}; 
        String codedString = "blah string";
 
        Inflater infl1 = new Inflater();
        Inflater infl2 = new Inflater();
 
        byte[] result = new byte[100];
        int decLen = 0;
 
        infl1.setInput(codedData, 0, codedData.length);
        try { 
            decLen = infl1.inflate(result, 10, 11);
        } catch (DataFormatException e) {
            fail("Unexpected DataFormatException");
        } 
 
        infl1.end();
        assertEquals(codedString, new String(result, 10, decLen));
        codedData[5] = 0;
 
        infl2.setInput(codedData, 0, codedData.length);
        try { 
            decLen = infl2.inflate(result, 10, 11);
            fail("Expected DataFormatException");
        } catch (DataFormatException e) {
            // expected 
        } 
 
        infl2.end();
    } 
 
	/** 
	 * @tests java.util.zip.Inflater#Inflater() 
	 */