decode() — netty Function Reference
Architecture documentation for the decode() function in BigIntegerDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 8428cfda_9bf1_560c_37ae_96a6787a071c["decode()"] 504c5c2a_3622_b0bf_68a9_ed7dfc9a7947["BigIntegerDecoder"] 8428cfda_9bf1_560c_37ae_96a6787a071c -->|defined in| 504c5c2a_3622_b0bf_68a9_ed7dfc9a7947 style 8428cfda_9bf1_560c_37ae_96a6787a071c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/factorial/BigIntegerDecoder.java lines 34–62
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
// Wait until the length prefix is available.
if (in.readableBytes() < 5) {
return;
}
in.markReaderIndex();
// Check the magic number.
int magicNumber = in.readUnsignedByte();
if (magicNumber != 'F') {
in.resetReaderIndex();
throw new CorruptedFrameException("Invalid magic number: " + magicNumber);
}
// Wait until the whole data is available.
int dataLength = in.readInt();
if (in.readableBytes() < dataLength) {
in.resetReaderIndex();
return;
}
// Convert the received data into a new BigInteger.
byte[] decoded = new byte[dataLength];
in.readBytes(decoded);
out.add(new BigInteger(decoded));
}
Domain
Subdomains
Source
Frequently Asked Questions
What does decode() do?
decode() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/factorial/BigIntegerDecoder.java.
Where is decode() defined?
decode() is defined in example/src/main/java/io/netty/example/factorial/BigIntegerDecoder.java at line 34.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free