decode() — netty Function Reference
Architecture documentation for the decode() function in Socks5PrivateAuthRequestDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 85085e10_d562_1c92_11bc_28add682c167["decode()"] 6b9f8608_de9b_43e5_4557_9bcfe906f178["Socks5PrivateAuthRequestDecoder"] 85085e10_d562_1c92_11bc_28add682c167 -->|defined in| 6b9f8608_de9b_43e5_4557_9bcfe906f178 95528e6d_620a_0dd2_5d13_e3be7eee7c28["fail()"] 85085e10_d562_1c92_11bc_28add682c167 -->|calls| 95528e6d_620a_0dd2_5d13_e3be7eee7c28 style 85085e10_d562_1c92_11bc_28add682c167 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5PrivateAuthRequestDecoder.java lines 36–80
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
try {
if (decoded) {
int readableBytes = in.readableBytes();
if (readableBytes > 0) {
out.add(in.readRetainedSlice(readableBytes));
}
return;
}
// Check if we have enough data to decode the message
if (in.readableBytes() < 2) {
return;
}
final int startOffset = in.readerIndex();
final byte version = in.getByte(startOffset);
if (version != 1) {
throw new DecoderException("unsupported subnegotiation version: " + version + " (expected: 1)");
}
final int tokenLength = in.getUnsignedByte(startOffset + 1);
// Check if the full message is available
if (in.readableBytes() < 2 + tokenLength) {
return;
}
// Read the version and token length
in.skipBytes(2);
// Read the token
byte[] token = new byte[tokenLength];
in.readBytes(token);
// Add the decoded token to the output list
out.add(new DefaultSocks5PrivateAuthRequest(token));
// Mark as decoded to handle remaining bytes in future calls
decoded = true;
} 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/Socks5PrivateAuthRequestDecoder.java.
Where is decode() defined?
decode() is defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5PrivateAuthRequestDecoder.java at line 36.
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