ByteBuf() — netty Function Reference
Architecture documentation for the ByteBuf() function in AbstractNioChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 17950ec1_b7aa_3f81_93a7_264def498e19["ByteBuf()"] ee3727e1_0d64_fa3f_39b7_5b5d3cee6721["AbstractNioChannel"] 17950ec1_b7aa_3f81_93a7_264def498e19 -->|defined in| ee3727e1_0d64_fa3f_39b7_5b5d3cee6721 style 17950ec1_b7aa_3f81_93a7_264def498e19 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/nio/AbstractNioChannel.java lines 509–533
protected final ByteBuf newDirectBuffer(ByteBuf buf) {
final int readableBytes = buf.readableBytes();
if (readableBytes == 0) {
ReferenceCountUtil.safeRelease(buf);
return Unpooled.EMPTY_BUFFER;
}
final ByteBufAllocator alloc = alloc();
if (alloc.isDirectBufferPooled()) {
ByteBuf directBuf = alloc.directBuffer(readableBytes);
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
ReferenceCountUtil.safeRelease(buf);
return directBuf;
}
final ByteBuf directBuf = ByteBufUtil.threadLocalDirectBuffer();
if (directBuf != null) {
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
ReferenceCountUtil.safeRelease(buf);
return directBuf;
}
// Allocating and deallocating an unpooled direct buffer is very expensive; give up.
return buf;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does ByteBuf() do?
ByteBuf() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/nio/AbstractNioChannel.java.
Where is ByteBuf() defined?
ByteBuf() is defined in transport/src/main/java/io/netty/channel/nio/AbstractNioChannel.java at line 509.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free