encode() — netty Function Reference
Architecture documentation for the encode() function in DeflateEncoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 4584d63c_2bfa_360c_1fe1_572d00814f47["encode()"] 3e2d1413_1ae5_e37c_290b_57bfb2bcef3b["DeflateEncoder"] 4584d63c_2bfa_360c_1fe1_572d00814f47 -->|defined in| 3e2d1413_1ae5_e37c_290b_57bfb2bcef3b bb225e07_e5ba_a989_94c1_9124f03babdb["rsv()"] 4584d63c_2bfa_360c_1fe1_572d00814f47 -->|calls| bb225e07_e5ba_a989_94c1_9124f03babdb style 4584d63c_2bfa_360c_1fe1_572d00814f47 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/extensions/compression/DeflateEncoder.java lines 85–110
@Override
protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception {
final ByteBuf compressedContent;
if (msg.content().isReadable()) {
compressedContent = compressContent(ctx, msg);
} else if (msg.isFinalFragment()) {
// Set empty DEFLATE block manually for unknown buffer size
// https://tools.ietf.org/html/rfc7692#section-7.2.3.6
compressedContent = EMPTY_DEFLATE_BLOCK.duplicate();
} else {
throw new CodecException("cannot compress content buffer");
}
final WebSocketFrame outMsg;
if (msg instanceof TextWebSocketFrame) {
outMsg = new TextWebSocketFrame(msg.isFinalFragment(), rsv(msg), compressedContent);
} else if (msg instanceof BinaryWebSocketFrame) {
outMsg = new BinaryWebSocketFrame(msg.isFinalFragment(), rsv(msg), compressedContent);
} else if (msg instanceof ContinuationWebSocketFrame) {
outMsg = new ContinuationWebSocketFrame(msg.isFinalFragment(), rsv(msg), compressedContent);
} else {
throw new CodecException("unexpected frame type: " + msg.getClass().getName());
}
out.add(outMsg);
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does encode() do?
encode() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/extensions/compression/DeflateEncoder.java.
Where is encode() defined?
encode() is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/extensions/compression/DeflateEncoder.java at line 85.
What does encode() call?
encode() calls 1 function(s): rsv.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free