Home / Function/ testCompositeToSingleBuffer() — netty Function Reference

testCompositeToSingleBuffer() — netty Function Reference

Architecture documentation for the testCompositeToSingleBuffer() function in AbstractCompositeByteBufTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  cd1ec100_a752_b246_a566_9a94ed67ae9a["testCompositeToSingleBuffer()"]
  47bc0a20_e243_89ff_132b_99ac6b23835f["AbstractCompositeByteBufTest"]
  cd1ec100_a752_b246_a566_9a94ed67ae9a -->|defined in| 47bc0a20_e243_89ff_132b_99ac6b23835f
  style cd1ec100_a752_b246_a566_9a94ed67ae9a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java lines 260–281

    @Test
    public void testCompositeToSingleBuffer() {
        CompositeByteBuf buf = compositeBuffer(3);

        buf.addComponent(wrappedBuffer(new byte[] {1, 2, 3}));
        assertEquals(1, buf.numComponents());

        buf.addComponent(wrappedBuffer(new byte[] {4}));
        assertEquals(2, buf.numComponents());

        buf.addComponent(wrappedBuffer(new byte[] {5, 6}));
        assertEquals(3, buf.numComponents());

        // NOTE: hard-coding 6 here, since it seems like addComponent doesn't bump the writer index.
        // I'm unsure as to whether or not this is correct behavior
        ByteBuffer nioBuffer = buf.nioBuffer(0, 6);
        byte[] bytes = nioBuffer.array();
        assertEquals(6, bytes.length);
        assertArrayEquals(new byte[] {1, 2, 3, 4, 5, 6}, bytes);

        buf.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testCompositeToSingleBuffer() do?
testCompositeToSingleBuffer() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java.
Where is testCompositeToSingleBuffer() defined?
testCompositeToSingleBuffer() is defined in buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java at line 260.

Analyze Your Own Codebase

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

Try Supermodel Free