FixedLengthFrameDecoder Class — netty Architecture
Architecture documentation for the FixedLengthFrameDecoder class in FixedLengthFrameDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a04858d5_c706_52cc_618d_bf0210ec94c1["FixedLengthFrameDecoder"] 7dc862b5_a83c_9083_661c_224efe8cd331["FixedLengthFrameDecoder.java"] a04858d5_c706_52cc_618d_bf0210ec94c1 -->|defined in| 7dc862b5_a83c_9083_661c_224efe8cd331 fe855492_16b3_8390_3447_127bd2bed730["FixedLengthFrameDecoder()"] a04858d5_c706_52cc_618d_bf0210ec94c1 -->|method| fe855492_16b3_8390_3447_127bd2bed730 d6122137_9fc1_4123_b85d_aa6dc00c7e4b["decode()"] a04858d5_c706_52cc_618d_bf0210ec94c1 -->|method| d6122137_9fc1_4123_b85d_aa6dc00c7e4b 421feb01_2877_e0d8_0ae6_0bd7192980a6["Object()"] a04858d5_c706_52cc_618d_bf0210ec94c1 -->|method| 421feb01_2877_e0d8_0ae6_0bd7192980a6
Relationship Graph
Source Code
codec-base/src/main/java/io/netty/handler/codec/FixedLengthFrameDecoder.java lines 41–79
public class FixedLengthFrameDecoder extends ByteToMessageDecoder {
private final int frameLength;
/**
* Creates a new instance.
*
* @param frameLength the length of the frame
*/
public FixedLengthFrameDecoder(int frameLength) {
checkPositive(frameLength, "frameLength");
this.frameLength = frameLength;
}
@Override
protected final void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
Object decoded = decode(ctx, in);
if (decoded != null) {
out.add(decoded);
}
}
/**
* Create a frame out of the {@link ByteBuf} and return it.
*
* @param ctx the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to
* @param in the {@link ByteBuf} from which to read data
* @return frame the {@link ByteBuf} which represent the frame or {@code null} if no frame could
* be created.
*/
protected Object decode(
@SuppressWarnings("UnusedParameters") ChannelHandlerContext ctx, ByteBuf in) throws Exception {
if (in.readableBytes() < frameLength) {
return null;
} else {
return in.readRetainedSlice(frameLength);
}
}
}
Source
Frequently Asked Questions
What is the FixedLengthFrameDecoder class?
FixedLengthFrameDecoder is a class in the netty codebase, defined in codec-base/src/main/java/io/netty/handler/codec/FixedLengthFrameDecoder.java.
Where is FixedLengthFrameDecoder defined?
FixedLengthFrameDecoder is defined in codec-base/src/main/java/io/netty/handler/codec/FixedLengthFrameDecoder.java at line 41.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free