Code example for Deflater

Methods: deflate

0
        assertDecompressed(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); 
        assertEquals(0, inflater.inflate(decompressed));
    } 
 
    private void deflateInflate(int flush) throws DataFormatException {
        int lastDeflated = deflater.deflate(compressed, totalDeflated,
                compressed.length - totalDeflated, flush);
        assertTrue(inflater.needsInput());
        inflater.setInput(compressed, totalDeflated, lastDeflated);
        totalDeflated += lastDeflated;
        totalInflated += inflater.inflate(decompressed, totalInflated,
                decompressed.length - totalInflated);
    } 
 
    private void assertDecompressed(int... expected) {
        for (int i = 0; i < decompressed.length; i++) {
            int expectedValue = i < expected.length ? expected[i] : 0;
            assertEquals(expectedValue, decompressed[i]);
        } 
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE