Home / Function/ testSequentialByteBufferBackedHeapBufferTransfer1() — netty Function Reference

testSequentialByteBufferBackedHeapBufferTransfer1() — netty Function Reference

Architecture documentation for the testSequentialByteBufferBackedHeapBufferTransfer1() function in AbstractByteBufTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  35e4d4ed_2ea4_17f2_e251_541d34b51a9c["testSequentialByteBufferBackedHeapBufferTransfer1()"]
  6540f2d1_cdad_6705_dd1d_9a24e2e53242["AbstractByteBufTest"]
  35e4d4ed_2ea4_17f2_e251_541d34b51a9c -->|defined in| 6540f2d1_cdad_6705_dd1d_9a24e2e53242
  style 35e4d4ed_2ea4_17f2_e251_541d34b51a9c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java lines 1746–1778

    @Test
    public void testSequentialByteBufferBackedHeapBufferTransfer1() {
        byte[] valueContent = new byte[BLOCK_SIZE * 2];
        ByteBuf value = wrappedBuffer(ByteBuffer.allocate(BLOCK_SIZE * 2));
        value.writerIndex(0);
        buffer.writerIndex(0);
        for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
            random.nextBytes(valueContent);
            value.setBytes(0, valueContent);
            assertEquals(0, buffer.readerIndex());
            assertEquals(i, buffer.writerIndex());
            buffer.writeBytes(value, random.nextInt(BLOCK_SIZE), BLOCK_SIZE);
            assertEquals(0, value.readerIndex());
            assertEquals(0, value.writerIndex());
        }

        random.setSeed(seed);
        byte[] expectedValueContent = new byte[BLOCK_SIZE * 2];
        ByteBuf expectedValue = wrappedBuffer(expectedValueContent);
        for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
            random.nextBytes(expectedValueContent);
            int valueOffset = random.nextInt(BLOCK_SIZE);
            value.setBytes(0, valueContent);
            assertEquals(i, buffer.readerIndex());
            assertEquals(CAPACITY, buffer.writerIndex());
            buffer.readBytes(value, valueOffset, BLOCK_SIZE);
            for (int j = valueOffset; j < valueOffset + BLOCK_SIZE; j ++) {
                assertEquals(expectedValue.getByte(j), value.getByte(j));
            }
            assertEquals(0, value.readerIndex());
            assertEquals(0, value.writerIndex());
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free