netty - How to set the length adjustment bytes mentioned in the LengthFieldBasedFrameDecoder class -
from lengthfieldbasedframedecoder
's documentation, allow user decode header field header 1
. encoder class allow user define such header field?
* advanced example shows case there * header between length field , message body. have specify * positive <tt>lengthadjustment</tt> decoder counts * header frame length calculation. * <pre> * lengthfieldoffset = 0 * lengthfieldlength = 3 * <b>lengthadjustment</b> = <b>2</b> (= length of header 1) * initialbytestostrip = 0 * * before decode (17 bytes) after decode (17 bytes) * +----------+----------+----------------+ +----------+----------+----------------+ * | length | header 1 | actual content |----->| length | header 1 | actual content | * | 0x00000c | 0xcafe | "hello, world" | | 0x00000c | 0xcafe | "hello, world" | * +----------+----------+----------------+ +----------+----------+----------------+
netty doesn't include such encoder should able write own , write bytes bytebuf before write down pipeline.
Comments
Post a Comment