Example Analysis of Netty distributed fixed length Decoder
This article mainly shows you the "example Analysis of Netty distributed fixed-length Decoder", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "sample Analysis of Netty distributed fixed-length Decoder".
Fixed length decoder
We have learned that the decoder needs to inherit ByteToMessageDecoder and rewrite the decode method to put the parsed objects into the collection, and the parsed objects can be propagated downward in ByteToMessageDecoder. This section takes you to analyze the simplest decoder, FixedLengthFrameDecoder, and start with it to understand the relevant principles of the decoder.
FixedLengthFrameDecoder is a fixed length decoder, and its function is to intercept a fixed number of bytes for decoding according to the fixed length.
See the definition of its class public class FixedLengthFrameDecoder extends ByteToMessageDecoder {/ / length size private final int frameLength; public FixedLengthFrameDecoder (int frameLength) {if (frameLength)