Home / Function/ testNioBuffersExpand2() — netty Function Reference

testNioBuffersExpand2() — netty Function Reference

Architecture documentation for the testNioBuffersExpand2() function in ChannelOutboundBufferTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  41beef69_9522_098f_455b_e61cce53289e["testNioBuffersExpand2()"]
  06eb8f18_da0c_40bf_fb14_47e2c94a6923["ChannelOutboundBufferTest"]
  41beef69_9522_098f_455b_e61cce53289e -->|defined in| 06eb8f18_da0c_40bf_fb14_47e2c94a6923
  31b49bd0_4c82_f6fd_3697_c6d8205d4cfe["TestChannel()"]
  41beef69_9522_098f_455b_e61cce53289e -->|calls| 31b49bd0_4c82_f6fd_3697_c6d8205d4cfe
  4bdec6f8_3c15_b5ee_d1a3_716048f52c5a["release()"]
  41beef69_9522_098f_455b_e61cce53289e -->|calls| 4bdec6f8_3c15_b5ee_d1a3_716048f52c5a
  style 41beef69_9522_098f_455b_e61cce53289e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/ChannelOutboundBufferTest.java lines 140–166

    @Test
    public void testNioBuffersExpand2() {
        TestChannel channel = new TestChannel();

        ChannelOutboundBuffer buffer = new ChannelOutboundBuffer(channel);

        CompositeByteBuf comp = compositeBuffer(256);
        ByteBuf buf = directBuffer().writeBytes("buf1".getBytes(CharsetUtil.US_ASCII));
        for (int i = 0; i < 65; i++) {
            comp.addComponent(true, buf.copy());
        }
        buffer.addMessage(comp, comp.readableBytes(), channel.voidPromise());

        assertEquals(0, buffer.nioBufferCount(), "Should still be 0 as not flushed yet");
        buffer.addFlush();
        ByteBuffer[] buffers = buffer.nioBuffers();
        assertEquals(65, buffer.nioBufferCount());
        for (int i = 0;  i < buffer.nioBufferCount(); i++) {
            if (i < 65) {
                assertEquals(buffers[i], buf.internalNioBuffer(buf.readerIndex(), buf.readableBytes()));
            } else {
                assertNull(buffers[i]);
            }
        }
        release(buffer);
        buf.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testNioBuffersExpand2() do?
testNioBuffersExpand2() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/ChannelOutboundBufferTest.java.
Where is testNioBuffersExpand2() defined?
testNioBuffersExpand2() is defined in transport/src/test/java/io/netty/channel/ChannelOutboundBufferTest.java at line 140.
What does testNioBuffersExpand2() call?
testNioBuffersExpand2() calls 2 function(s): TestChannel, release.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free