testDuplicate() — netty Function Reference
Architecture documentation for the testDuplicate() function in AbstractByteBufTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD c01041aa_f17c_e29a_e634_6c4764ea71d1["testDuplicate()"] 6540f2d1_cdad_6705_dd1d_9a24e2e53242["AbstractByteBufTest"] c01041aa_f17c_e29a_e634_6c4764ea71d1 -->|defined in| 6540f2d1_cdad_6705_dd1d_9a24e2e53242 style c01041aa_f17c_e29a_e634_6c4764ea71d1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java lines 2071–2093
@Test
public void testDuplicate() {
for (int i = 0; i < buffer.capacity(); i ++) {
byte value = (byte) random.nextInt();
buffer.setByte(i, value);
}
final int readerIndex = CAPACITY / 3;
final int writerIndex = CAPACITY * 2 / 3;
buffer.setIndex(readerIndex, writerIndex);
// Make sure all properties are copied.
ByteBuf duplicate = buffer.duplicate();
assertSame(buffer.order(), duplicate.order());
assertEquals(buffer.readableBytes(), duplicate.readableBytes());
assertEquals(0, buffer.compareTo(duplicate));
// Make sure the buffer content is shared.
buffer.setByte(readerIndex, (byte) (buffer.getByte(readerIndex) + 1));
assertEquals(buffer.getByte(readerIndex), duplicate.getByte(duplicate.readerIndex()));
duplicate.setByte(duplicate.readerIndex(), (byte) (duplicate.getByte(duplicate.readerIndex()) + 1));
assertEquals(buffer.getByte(readerIndex), duplicate.getByte(duplicate.readerIndex()));
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testDuplicate() do?
testDuplicate() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java.
Where is testDuplicate() defined?
testDuplicate() is defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java at line 2071.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free