TestRecvByteBufAllocator Class — netty Architecture
Architecture documentation for the TestRecvByteBufAllocator class in SocketAutoReadTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 8d2b77bc_e9c8_21e1_78cc_3b09e651679b["TestRecvByteBufAllocator"] 9b48ca78_1238_62ed_f777_a60e46d03430["SocketAutoReadTest.java"] 8d2b77bc_e9c8_21e1_78cc_3b09e651679b -->|defined in| 9b48ca78_1238_62ed_f777_a60e46d03430 58e067f6_7beb_7494_d777_32d328c00d52["ExtendedHandle()"] 8d2b77bc_e9c8_21e1_78cc_3b09e651679b -->|method| 58e067f6_7beb_7494_d777_32d328c00d52
Relationship Graph
Source Code
testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketAutoReadTest.java lines 169–232
private static final class TestRecvByteBufAllocator implements RecvByteBufAllocator {
@Override
public ExtendedHandle newHandle() {
return new ExtendedHandle() {
private ChannelConfig config;
private int attemptedBytesRead;
private int lastBytesRead;
@Override
public ByteBuf allocate(ByteBufAllocator alloc) {
return alloc.ioBuffer(guess(), guess());
}
@Override
public int guess() {
return 1; // only ever allocate buffers of size 1 to ensure the number of reads is controlled.
}
@Override
public void reset(ChannelConfig config) {
this.config = config;
}
@Override
public void incMessagesRead(int numMessages) {
// No need to track the number of messages read because it is not used.
}
@Override
public void lastBytesRead(int bytes) {
lastBytesRead = bytes;
}
@Override
public int lastBytesRead() {
return lastBytesRead;
}
@Override
public void attemptedBytesRead(int bytes) {
attemptedBytesRead = bytes;
}
@Override
public int attemptedBytesRead() {
return attemptedBytesRead;
}
@Override
public boolean continueReading() {
return config.isAutoRead();
}
@Override
public boolean continueReading(UncheckedBooleanSupplier maybeMoreDataSupplier) {
return config.isAutoRead();
}
@Override
public void readComplete() {
// Nothing needs to be done or adjusted after each read cycle is completed.
}
};
}
}
Source
Frequently Asked Questions
What is the TestRecvByteBufAllocator class?
TestRecvByteBufAllocator is a class in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketAutoReadTest.java.
Where is TestRecvByteBufAllocator defined?
TestRecvByteBufAllocator is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketAutoReadTest.java at line 169.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free