LengthFieldPrepender Class — netty Architecture
Architecture documentation for the LengthFieldPrepender class in LengthFieldPrepender.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 7b43e9c4_2b39_a856_0445_cfeef19dc54a["LengthFieldPrepender"] c910c40f_5022_74ab_23d0_02d2727a8927["LengthFieldPrepender.java"] 7b43e9c4_2b39_a856_0445_cfeef19dc54a -->|defined in| c910c40f_5022_74ab_23d0_02d2727a8927 4632f79e_e5ad_ff2d_952e_a29a74035702["LengthFieldPrepender()"] 7b43e9c4_2b39_a856_0445_cfeef19dc54a -->|method| 4632f79e_e5ad_ff2d_952e_a29a74035702 623eb732_bf2f_85ee_4883_3927a552fc2d["encode()"] 7b43e9c4_2b39_a856_0445_cfeef19dc54a -->|method| 623eb732_bf2f_85ee_4883_3927a552fc2d
Relationship Graph
Source Code
codec-base/src/main/java/io/netty/handler/codec/LengthFieldPrepender.java lines 55–202
@Sharable
public class LengthFieldPrepender extends MessageToMessageEncoder<ByteBuf> {
private final ByteOrder byteOrder;
private final int lengthFieldLength;
private final boolean lengthIncludesLengthFieldLength;
private final int lengthAdjustment;
/**
* Creates a new instance.
*
* @param lengthFieldLength the length of the prepended length field.
* Only 1, 2, 3, 4, and 8 are allowed.
*
* @throws IllegalArgumentException
* if {@code lengthFieldLength} is not 1, 2, 3, 4, or 8
*/
public LengthFieldPrepender(int lengthFieldLength) {
this(lengthFieldLength, false);
}
/**
* Creates a new instance.
*
* @param lengthFieldLength the length of the prepended length field.
* Only 1, 2, 3, 4, and 8 are allowed.
* @param lengthIncludesLengthFieldLength
* if {@code true}, the length of the prepended
* length field is added to the value of the
* prepended length field.
*
* @throws IllegalArgumentException
* if {@code lengthFieldLength} is not 1, 2, 3, 4, or 8
*/
public LengthFieldPrepender(int lengthFieldLength, boolean lengthIncludesLengthFieldLength) {
this(lengthFieldLength, 0, lengthIncludesLengthFieldLength);
}
/**
* Creates a new instance.
*
* @param lengthFieldLength the length of the prepended length field.
* Only 1, 2, 3, 4, and 8 are allowed.
* @param lengthAdjustment the compensation value to add to the value
* of the length field
*
* @throws IllegalArgumentException
* if {@code lengthFieldLength} is not 1, 2, 3, 4, or 8
*/
public LengthFieldPrepender(int lengthFieldLength, int lengthAdjustment) {
this(lengthFieldLength, lengthAdjustment, false);
}
/**
* Creates a new instance.
*
* @param lengthFieldLength the length of the prepended length field.
* Only 1, 2, 3, 4, and 8 are allowed.
* @param lengthAdjustment the compensation value to add to the value
* of the length field
* @param lengthIncludesLengthFieldLength
* if {@code true}, the length of the prepended
* length field is added to the value of the
* prepended length field.
*
* @throws IllegalArgumentException
* if {@code lengthFieldLength} is not 1, 2, 3, 4, or 8
*/
public LengthFieldPrepender(int lengthFieldLength, int lengthAdjustment, boolean lengthIncludesLengthFieldLength) {
this(ByteOrder.BIG_ENDIAN, lengthFieldLength, lengthAdjustment, lengthIncludesLengthFieldLength);
}
/**
* Creates a new instance.
*
* @param byteOrder the {@link ByteOrder} of the length field
* @param lengthFieldLength the length of the prepended length field.
* Only 1, 2, 3, 4, and 8 are allowed.
* @param lengthAdjustment the compensation value to add to the value
* of the length field
* @param lengthIncludesLengthFieldLength
Source
Frequently Asked Questions
What is the LengthFieldPrepender class?
LengthFieldPrepender is a class in the netty codebase, defined in codec-base/src/main/java/io/netty/handler/codec/LengthFieldPrepender.java.
Where is LengthFieldPrepender defined?
LengthFieldPrepender is defined in codec-base/src/main/java/io/netty/handler/codec/LengthFieldPrepender.java at line 55.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free