decode() — netty Function Reference
Architecture documentation for the decode() function in Socks5CommandRequestDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a7f50bee_53d6_ab01_d695_13dc24d8f39f["decode()"] e8e9c6d8_866c_2c7f_bad6_de6efe9ff434["Socks5CommandRequestDecoder"] a7f50bee_53d6_ab01_d695_13dc24d8f39f -->|defined in| e8e9c6d8_866c_2c7f_bad6_de6efe9ff434 fb00be81_3365_e361_899e_856ea8cfc811["fail()"] a7f50bee_53d6_ab01_d695_13dc24d8f39f -->|calls| fb00be81_3365_e361_899e_856ea8cfc811 style a7f50bee_53d6_ab01_d695_13dc24d8f39f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5CommandRequestDecoder.java lines 58–93
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
try {
switch (state()) {
case INIT: {
final byte version = in.readByte();
if (version != SocksVersion.SOCKS5.byteValue()) {
throw new DecoderException(
"unsupported version: " + version + " (expected: " + SocksVersion.SOCKS5.byteValue() + ')');
}
final Socks5CommandType type = Socks5CommandType.valueOf(in.readByte());
in.skipBytes(1); // RSV
final Socks5AddressType dstAddrType = Socks5AddressType.valueOf(in.readByte());
final String dstAddr = addressDecoder.decodeAddress(dstAddrType, in);
final int dstPort = ByteBufUtil.readUnsignedShortBE(in);
out.add(new DefaultSocks5CommandRequest(type, dstAddrType, dstAddr, dstPort));
checkpoint(State.SUCCESS);
}
case SUCCESS: {
int readableBytes = actualReadableBytes();
if (readableBytes > 0) {
out.add(in.readRetainedSlice(readableBytes));
}
break;
}
case FAILURE: {
in.skipBytes(actualReadableBytes());
break;
}
}
} catch (Exception e) {
fail(out, e);
}
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does decode() do?
decode() is a function in the netty codebase, defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5CommandRequestDecoder.java.
Where is decode() defined?
decode() is defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5CommandRequestDecoder.java at line 58.
What does decode() call?
decode() calls 1 function(s): fail.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free