@Override public void encode(ChannelBuffer compressed) { while (!compressor.needsInput()) { int numBytes = compressor.deflate(out, 0, out.length, Deflater.SYNC_FLUSH); compressed.writeBytes(out, 0, numBytes); } }
@Override public void decode(ChannelBuffer decompressed) throws Exception { try { int numBytes = decompressor.inflate(out); if (numBytes == 0 && decompressor.needsDictionary()) { decompressor.setDictionary(SPDY_DICT); numBytes = decompressor.inflate(out); } decompressed.writeBytes(out, 0, numBytes); } catch (DataFormatException e) { throw new SpdyProtocolException("Received invalid header block", e); } }