private int decompress()

in src/main/java/com/twitter/whiskey/net/SpdyHeaderBlockZlibDecoder.java [69:93]


    private int decompress(int streamId) throws Exception {

        byte[] out = decompressed.array();
        int offset = decompressed.arrayOffset() + decompressed.position();
        try {
            int numBytes = decompressor.inflate(out, offset, decompressed.remaining());
            if (numBytes == 0 && decompressor.needsDictionary()) {
                try {
                    decompressor.setDictionary(SpdyCodecUtil.SPDY_DICT);
                } catch (IllegalArgumentException ignored) {
                    throw INVALID_HEADER_BLOCK;
                }
                numBytes = decompressor.inflate(out, offset, decompressed.remaining());
            }

            decompressed.position(decompressed.position() + numBytes);
            decompressed.flip();
            super.decode(decompressed, streamId);
            decompressed.compact();

            return numBytes;
        } catch (DataFormatException e) {
            throw new SpdyProtocolException("Received invalid header block", e);
        }
    }