Code example for Inflater

Methods: getBytesWritten, getTotalIn, getTotalOut, inflate, setInput

0
    ) 
    public void test_getBytesRead() throws DataFormatException, 
            UnsupportedEncodingException { 
        // Regression test for HARMONY-158 
        Deflater def = new Deflater();
        Inflater inf = new Inflater();
        assertEquals(0, def.getTotalIn());
        assertEquals(0, def.getTotalOut());
        assertEquals(0, def.getBytesRead());
        // Encode a String into bytes 
        String inputString = "blahblahblah??";
        byte[] input = inputString.getBytes("UTF-8");
 
        // Compress the bytes 
        byte[] output = new byte[100];
        def.setInput(input);
        def.finish();
        def.deflate(output);
        inf.setInput(output);
        int compressedDataLength = inf.inflate(input);
        assertEquals(16, inf.getTotalIn());
        assertEquals(compressedDataLength, inf.getTotalOut());
        assertEquals(16, inf.getBytesRead());
    } 
 
    /** 
     * @tests java.util.zip.Deflater#getBytesRead() 
     */