ByteBuf() — netty Function Reference
Architecture documentation for the ByteBuf() function in DeflateDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 82e2e233_0a09_a0ee_cf5b_f63c2adbdd16["ByteBuf()"] 42259036_5c94_ec21_9d9a_f9cda6ed6e54["DeflateDecoder"] 82e2e233_0a09_a0ee_cf5b_f63c2adbdd16 -->|defined in| 42259036_5c94_ec21_9d9a_f9cda6ed6e54 507ed1f8_ae2a_8bfd_39e5_4457113d2837["appendFrameTail()"] 82e2e233_0a09_a0ee_cf5b_f63c2adbdd16 -->|calls| 507ed1f8_ae2a_8bfd_39e5_4457113d2837 7f7b9aa8_4ffe_38a1_2a50_c6bab89f05e5["cleanup()"] 82e2e233_0a09_a0ee_cf5b_f63c2adbdd16 -->|calls| 7f7b9aa8_4ffe_38a1_2a50_c6bab89f05e5 style 82e2e233_0a09_a0ee_cf5b_f63c2adbdd16 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/extensions/compression/DeflateDecoder.java lines 111–157
private ByteBuf decompressContent(ChannelHandlerContext ctx, WebSocketFrame msg) {
if (decoder == null) {
if (!(msg instanceof TextWebSocketFrame) && !(msg instanceof BinaryWebSocketFrame)) {
throw new CodecException("unexpected initial frame type: " + msg.getClass().getName());
}
decoder = EmbeddedChannel.builder()
.handlers(ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE, maxAllocation))
.build();
}
boolean readable = msg.content().isReadable();
boolean emptyDeflateBlock = EMPTY_DEFLATE_BLOCK.equals(msg.content());
decoder.writeInbound(msg.content().retain());
if (appendFrameTail(msg)) {
decoder.writeInbound(FRAME_TAIL.duplicate());
}
CompositeByteBuf compositeDecompressedContent = ctx.alloc().compositeBuffer();
for (;;) {
ByteBuf partUncompressedContent = decoder.readInbound();
if (partUncompressedContent == null) {
break;
}
if (!partUncompressedContent.isReadable()) {
partUncompressedContent.release();
continue;
}
compositeDecompressedContent.addComponent(true, partUncompressedContent);
}
// Correctly handle empty frames
// See https://github.com/netty/netty/issues/4348
if (!emptyDeflateBlock && readable && compositeDecompressedContent.numComponents() <= 0) {
// Sometimes after fragmentation the last frame
// May contain left-over data that doesn't affect decompression
if (!(msg instanceof ContinuationWebSocketFrame)) {
compositeDecompressedContent.release();
throw new CodecException("cannot read uncompressed buffer");
}
}
if (msg.isFinalFragment() && noContext) {
cleanup();
}
return compositeDecompressedContent;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does ByteBuf() do?
ByteBuf() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/extensions/compression/DeflateDecoder.java.
Where is ByteBuf() defined?
ByteBuf() is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/extensions/compression/DeflateDecoder.java at line 111.
What does ByteBuf() call?
ByteBuf() calls 2 function(s): appendFrameTail, cleanup.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free