Is it necessary to use a delimiter such as LengthFieldBasedFrameDecoder with Netty’s ZlibDecoders? I had an issue where the decoder would sometimes error with “unknown compression method”, this went away when I modified the pipeline to delimit the data. The javadocs for the Zlib encoder/decoder don’t mention this as required, though their super classes do.
Is it necessary to use a delimiter such as LengthFieldBasedFrameDecoder with Netty’s ZlibDecoders? I
Share
It depends on transport protocol and how the compression is applied to the message/frame,
If compression is applied only for the content part, like below (like http), you don’t need LengthFieldBasedFrameDecoder, because your decoder/encoder have to use an DecoderEmbedder/EncoderEmbedder with ZlibDecoder/ZlibEncoder internally.
If the compression is applied to to whole frame and transport protocol is TCP, then zipped frame should have header parameter to identify the message length to read it fully. So you will need a LengthFieldBasedFrameDecoder and LengthFieldPrepender in the pipeline