For example, LengthFieldPrepender(2) will encode the
following 12-bytes string:
+----------------+ | "HELLO, WORLD" | +----------------+into the following:
+--------+----------------+ + 0x000C | "HELLO, WORLD" | +--------+----------------+If you turned on the
lengthIncludesLengthFieldLength flag in the
constructor, the encoded data would look like the following
(12 (original data) + 2 (prepended data) = 14 (0xE)):
+--------+----------------+ + 0x000E | "HELLO, WORLD" | +--------+----------------+
| Modifier and Type | Field and Description |
|---|---|
| private final ByteOrder | |
| private final int | |
| private final int | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | LengthFieldPrepender(int
the length of the prepended length field.
Only 1, 2, 3, 4, and 8 are allowed. lengthFieldLength)Creates a new instance. |
| public | LengthFieldPrepender(int
the length of the prepended length field.
Only 1, 2, 3, 4, and 8 are allowed. lengthFieldLength, boolean if lengthIncludesLengthFieldLength)true, the length of the prepended
length field is added to the value of the
prepended length field.Creates a new instance. |
| public | LengthFieldPrepender(int
the length of the prepended length field.
Only 1, 2, 3, 4, and 8 are allowed. lengthFieldLength, int the compensation value to add to the value
of the length field lengthAdjustment)Creates a new instance. |
| public | LengthFieldPrepender(int
the length of the prepended length field.
Only 1, 2, 3, 4, and 8 are allowed. lengthFieldLength, int the compensation value to add to the value
of the length field lengthAdjustment, boolean if lengthIncludesLengthFieldLength)true, the length of the prepended
length field is added to the value of the
prepended length field.Creates a new instance. |
| public | LengthFieldPrepender(ByteOrder
the byteOrder, int ByteOrder of the length fieldthe length of the prepended length field.
Only 1, 2, 3, 4, and 8 are allowed. lengthFieldLength, int the compensation value to add to the value
of the length field lengthAdjustment, boolean if lengthIncludesLengthFieldLength)true, the length of the prepended
length field is added to the value of the
prepended length field.Creates a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | encode(ChannelHandlerContext
the ctx, ByteBuf ChannelHandlerContext which this MessageToMessageEncoder belongs tothe message to encode to an other one msg, List<Object> the out)List into which the encoded msg should be added
needs to do some kind of aggregationImplements abstract io. |
| byteOrder | back to summary |
|---|---|
| private final ByteOrder byteOrder | |
| lengthAdjustment | back to summary |
|---|---|
| private final int lengthAdjustment | |
| lengthFieldLength | back to summary |
|---|---|
| private final int lengthFieldLength | |
| lengthIncludesLengthFieldLength | back to summary |
|---|---|
| private final boolean lengthIncludesLengthFieldLength | |
| LengthFieldPrepender | back to summary |
|---|---|
| public LengthFieldPrepender(int lengthFieldLength) Creates a new instance.
| |
| LengthFieldPrepender | back to summary |
|---|---|
| public LengthFieldPrepender(int lengthFieldLength, boolean lengthIncludesLengthFieldLength) Creates a new instance.
| |
| LengthFieldPrepender | back to summary |
|---|---|
| public LengthFieldPrepender(int lengthFieldLength, int lengthAdjustment) Creates a new instance.
| |
| LengthFieldPrepender | back to summary |
|---|---|
| public LengthFieldPrepender(int lengthFieldLength, int lengthAdjustment, boolean lengthIncludesLengthFieldLength) Creates a new instance.
| |
| LengthFieldPrepender | back to summary |
|---|---|
| public LengthFieldPrepender(ByteOrder byteOrder, int lengthFieldLength, int lengthAdjustment, boolean lengthIncludesLengthFieldLength) Creates a new instance.
| |
| encode | back to summary |
|---|---|
| protected void encode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception Implements abstract io. Doc from io. Encode from one message to an other. This method will be called for each written message that can be handled by this encoder.
| |