Home / Function/ allocateNodeLengthsWithRelocation() — netty Function Reference

allocateNodeLengthsWithRelocation() — netty Function Reference

Architecture documentation for the allocateNodeLengthsWithRelocation() function in Bzip2HuffmanAllocator.java from the netty codebase.

Function java Buffer Allocators calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  313bded7_9d4e_2a33_2056_0b95ca399438["allocateNodeLengthsWithRelocation()"]
  3ede8457_e9d7_5e55_8fd7_02b725a73605["Bzip2HuffmanAllocator"]
  313bded7_9d4e_2a33_2056_0b95ca399438 -->|defined in| 3ede8457_e9d7_5e55_8fd7_02b725a73605
  2de6ad84_ece2_e1f6_0d2d_5992144ef04b["allocateHuffmanCodeLengths()"]
  2de6ad84_ece2_e1f6_0d2d_5992144ef04b -->|calls| 313bded7_9d4e_2a33_2056_0b95ca399438
  9ea0eddc_76b9_92b2_0ab9_81aa6582f3b6["first()"]
  313bded7_9d4e_2a33_2056_0b95ca399438 -->|calls| 9ea0eddc_76b9_92b2_0ab9_81aa6582f3b6
  style 313bded7_9d4e_2a33_2056_0b95ca399438 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java lines 122–150

    private static void allocateNodeLengthsWithRelocation(final int[] array,
                                                           final int nodesToMove, final int insertDepth) {
        int firstNode = array.length - 2;
        int nextNode = array.length - 1;
        int currentDepth = insertDepth == 1 ? 2 : 1;
        int nodesLeftToMove = insertDepth == 1 ? nodesToMove - 2 : nodesToMove;

        for (int availableNodes = currentDepth << 1; availableNodes > 0; currentDepth++) {
            final int lastNode = firstNode;
            firstNode = firstNode <= nodesToMove ? firstNode : first(array, lastNode - 1, nodesToMove);

            int offset = 0;
            if (currentDepth >= insertDepth) {
                offset = Math.min(nodesLeftToMove, 1 << (currentDepth - insertDepth));
            } else if (currentDepth == insertDepth - 1) {
                offset = 1;
                if (array[firstNode] == lastNode) {
                    firstNode++;
                }
            }

            for (int i = availableNodes - (lastNode - firstNode + offset); i > 0; i--) {
                array[nextNode--] = currentDepth;
            }

            nodesLeftToMove -= offset;
            availableNodes = (lastNode - firstNode + offset) << 1;
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does allocateNodeLengthsWithRelocation() do?
allocateNodeLengthsWithRelocation() is a function in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java.
Where is allocateNodeLengthsWithRelocation() defined?
allocateNodeLengthsWithRelocation() is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java at line 122.
What does allocateNodeLengthsWithRelocation() call?
allocateNodeLengthsWithRelocation() calls 1 function(s): first.
What calls allocateNodeLengthsWithRelocation()?
allocateNodeLengthsWithRelocation() is called by 1 function(s): allocateHuffmanCodeLengths.

Analyze Your Own Codebase

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

Try Supermodel Free