Home / Function/ testAllocateBuffer() — netty Function Reference

testAllocateBuffer() — netty Function Reference

Architecture documentation for the testAllocateBuffer() function in Lz4FrameEncoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d53150d4_a5fb_32f4_fc51_9c98d577a401["testAllocateBuffer()"]
  16452743_407c_c5f6_ee9f_baa8b84020f0["Lz4FrameEncoderTest"]
  d53150d4_a5fb_32f4_fc51_9c98d577a401 -->|defined in| 16452743_407c_c5f6_ee9f_baa8b84020f0
  5d65cf45_9814_95d1_0f8d_2f37ba79bf9a["testAllocateDirectBuffer()"]
  5d65cf45_9814_95d1_0f8d_2f37ba79bf9a -->|calls| d53150d4_a5fb_32f4_fc51_9c98d577a401
  3cfcf416_57c5_d367_ed41_452b08c2c77c["testAllocateHeapBuffer()"]
  3cfcf416_57c5_d367_ed41_452b08c2c77c -->|calls| d53150d4_a5fb_32f4_fc51_9c98d577a401
  style d53150d4_a5fb_32f4_fc51_9c98d577a401 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-compression/src/test/java/io/netty/handler/codec/compression/Lz4FrameEncoderTest.java lines 123–149

    private void testAllocateBuffer(int blockSize, int bufSize, boolean preferDirect) {
        // allocate the input buffer to an arbitrary size less than the blockSize
        ByteBuf in = ByteBufAllocator.DEFAULT.buffer(bufSize, bufSize);
        in.writerIndex(in.capacity());

        ByteBuf out = null;
        try {
            Lz4FrameEncoder encoder = newEncoder(blockSize, Lz4FrameEncoder.DEFAULT_MAX_ENCODE_SIZE);
            out = encoder.allocateBuffer(ctx, in, preferDirect);
            assertNotNull(out);
            if (NONALLOCATABLE_SIZE == bufSize) {
                assertFalse(out.isWritable());
            } else {
                assertTrue(out.writableBytes() > 0);
                if (!preferDirect) {
                    // Only check if preferDirect is not true as if a direct buffer is returned or not depends on
                    // if sun.misc.Unsafe is present.
                    assertFalse(out.isDirect());
                }
            }
        } finally {
            in.release();
            if (out != null) {
                out.release();
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testAllocateBuffer() do?
testAllocateBuffer() is a function in the netty codebase, defined in codec-compression/src/test/java/io/netty/handler/codec/compression/Lz4FrameEncoderTest.java.
Where is testAllocateBuffer() defined?
testAllocateBuffer() is defined in codec-compression/src/test/java/io/netty/handler/codec/compression/Lz4FrameEncoderTest.java at line 123.
What calls testAllocateBuffer()?
testAllocateBuffer() is called by 2 function(s): testAllocateDirectBuffer, testAllocateHeapBuffer.

Analyze Your Own Codebase

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

Try Supermodel Free