ProtobufDecoderNano Class — netty Architecture
Architecture documentation for the ProtobufDecoderNano class in ProtobufDecoderNano.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 5026f899_3152_4967_182c_1f98ed56e525["ProtobufDecoderNano"] b8c67c29_4d8c_9245_f7e5_b24e9c1301cf["ProtobufDecoderNano.java"] 5026f899_3152_4967_182c_1f98ed56e525 -->|defined in| b8c67c29_4d8c_9245_f7e5_b24e9c1301cf 47eeacfe_5665_cb3c_4a6e_ee86230a333a["ProtobufDecoderNano()"] 5026f899_3152_4967_182c_1f98ed56e525 -->|method| 47eeacfe_5665_cb3c_4a6e_ee86230a333a 1441d3aa_2ead_f9d4_ff1f_df2ff53ef6e7["decode()"] 5026f899_3152_4967_182c_1f98ed56e525 -->|method| 1441d3aa_2ead_f9d4_ff1f_df2ff53ef6e7
Relationship Graph
Source Code
codec-protobuf/src/main/java/io/netty/handler/codec/protobuf/ProtobufDecoderNano.java lines 62–89
@Sharable
public class ProtobufDecoderNano extends MessageToMessageDecoder<ByteBuf> {
private final Class<? extends MessageNano> clazz;
/**
* Creates a new instance.
*/
public ProtobufDecoderNano(Class<? extends MessageNano> clazz) {
super(ByteBuf.class);
this.clazz = ObjectUtil.checkNotNull(clazz, "You must provide a Class");
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out)
throws Exception {
final byte[] array;
final int offset;
final int length = msg.readableBytes();
if (msg.hasArray()) {
array = msg.array();
offset = msg.arrayOffset() + msg.readerIndex();
} else {
array = ByteBufUtil.getBytes(msg, msg.readerIndex(), length, false);
offset = 0;
}
MessageNano prototype = clazz.getConstructor().newInstance();
out.add(MessageNano.mergeFrom(prototype, array, offset, length));
}
}
Source
Frequently Asked Questions
What is the ProtobufDecoderNano class?
ProtobufDecoderNano is a class in the netty codebase, defined in codec-protobuf/src/main/java/io/netty/handler/codec/protobuf/ProtobufDecoderNano.java.
Where is ProtobufDecoderNano defined?
ProtobufDecoderNano is defined in codec-protobuf/src/main/java/io/netty/handler/codec/protobuf/ProtobufDecoderNano.java at line 62.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free