Home / Function/ validateAndCalculateChunkSize() — netty Function Reference

validateAndCalculateChunkSize() — netty Function Reference

Architecture documentation for the validateAndCalculateChunkSize() function in PooledByteBufAllocator.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f7d2fc1b_621e_f2d6_a105_854aba5e1426["validateAndCalculateChunkSize()"]
  f5ea31b4_1e4c_94f0_32cf_d4ab3e538b0a["PooledByteBufAllocator"]
  f7d2fc1b_621e_f2d6_a105_854aba5e1426 -->|defined in| f5ea31b4_1e4c_94f0_32cf_d4ab3e538b0a
  fd5b10b7_1fc6_6bf3_f94d_1c41e0794e60["PooledByteBufAllocator()"]
  fd5b10b7_1fc6_6bf3_f94d_1c41e0794e60 -->|calls| f7d2fc1b_621e_f2d6_a105_854aba5e1426
  style f7d2fc1b_621e_f2d6_a105_854aba5e1426 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java lines 362–377

    private static int validateAndCalculateChunkSize(int pageSize, int maxOrder) {
        if (maxOrder > 14) {
            throw new IllegalArgumentException("maxOrder: " + maxOrder + " (expected: 0-14)");
        }

        // Ensure the resulting chunkSize does not overflow.
        int chunkSize = pageSize;
        for (int i = maxOrder; i > 0; i --) {
            if (chunkSize > MAX_CHUNK_SIZE / 2) {
                throw new IllegalArgumentException(String.format(
                        "pageSize (%d) << maxOrder (%d) must not exceed %d", pageSize, maxOrder, MAX_CHUNK_SIZE));
            }
            chunkSize <<= 1;
        }
        return chunkSize;
    }

Domain

Subdomains

Frequently Asked Questions

What does validateAndCalculateChunkSize() do?
validateAndCalculateChunkSize() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java.
Where is validateAndCalculateChunkSize() defined?
validateAndCalculateChunkSize() is defined in buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java at line 362.
What calls validateAndCalculateChunkSize()?
validateAndCalculateChunkSize() is called by 1 function(s): PooledByteBufAllocator.

Analyze Your Own Codebase

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

Try Supermodel Free