netty/netty — Issue #86: FrameDecoder that is a combination of DelimiterBased and LengthBased
Author: menacher
Created: 2011-11-29 12:46:28+00:00
State: open

Many times, I have to deal with binary packets which start with a length byte(s) and always end with a delimiter byte(s) to signify end of frame. I have found this pattern useful to sync with the client again, when partial frames or corrupted frames are transmitted.

If this is a normal usecase, can we have an implementation which will
1) Do normal length based decoding.
2) If last byte is the expected delimiter, provide the frame to the next decoder/handler in pipeline.
3) If not, then search for delimiter byte(s) within the incoming bytes and discard the portion till the delimiter byte(s).
4) Redo step 1 onwards.