Home / Function/ testSetBytesWithZeroLength() — netty Function Reference

testSetBytesWithZeroLength() — netty Function Reference

Architecture documentation for the testSetBytesWithZeroLength() function in UnsafeByteBufUtilTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  88fb454a_1c15_e22c_db36_64481e6feb12["testSetBytesWithZeroLength()"]
  9a18ae5b_9169_5444_e060_c39f7f301455["UnsafeByteBufUtilTest"]
  88fb454a_1c15_e22c_db36_64481e6feb12 -->|defined in| 9a18ae5b_9169_5444_e060_c39f7f301455
  style 88fb454a_1c15_e22c_db36_64481e6feb12 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/UnsafeByteBufUtilTest.java lines 116–138

    @Test
    public void testSetBytesWithZeroLength() {
        final byte[] testData = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
        final int length = testData.length;

        final UnpooledByteBufAllocator alloc = new UnpooledByteBufAllocator(true);
        final UnpooledDirectByteBuf targetBuffer = new UnpooledDirectByteBuf(alloc, length, length);

        try {
            final byte[] beforeSet = new byte[length];
            targetBuffer.getBytes(0, beforeSet, 0, length);

            UnsafeByteBufUtil.setBytes(targetBuffer,
                    directBufferAddress(targetBuffer.nioBuffer()), 0, testData, 0, 0);

            final byte[] check = new byte[length];
            targetBuffer.getBytes(0, check, 0, length);

            assertArrayEquals(beforeSet, check);
        } finally {
            targetBuffer.release();
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free