Code example for Deflater

Methods: deflatefinishgetBytesReadgetTotalIngetTotalOutsetInput

0
        while (!defl.finished()) {
            defl.deflate(outPutBuf);
        } 
        int totalOut = defl.getTotalOut();
        defl.end();
 
        // test to see if the compression ratio is the same as setting the level 
        // on a deflater 
        outPutBuf = new byte[500];
        defl = new Deflater();
        defl.setLevel(3);
        defl.setInput(byteArray);
        while (!defl.needsInput()) {
            defl.deflate(outPutBuf);
        } 
        defl.finish();
        while (!defl.finished()) {
            defl.deflate(outPutBuf);
        } 
        assertEquals(totalOut, defl.getTotalOut());
        defl.end();
 
        // testing boundaries 
        try { 
            Deflater boundDefl = new Deflater();
            // Level must be between 0-9 
Stop searching for code, let great code find you!  Add Codota to your java IDE