Home / Function/ setCapacity() — netty Function Reference

setCapacity() — netty Function Reference

Architecture documentation for the setCapacity() function in QpackDecoderDynamicTable.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  fc3a2afd_f371_ac06_cae3_179d416e4835["setCapacity()"]
  e47c8f6a_f830_eebc_e4ee_95298d931d9b["QpackDecoderDynamicTable"]
  fc3a2afd_f371_ac06_cae3_179d416e4835 -->|defined in| e47c8f6a_f830_eebc_e4ee_95298d931d9b
  9fc1bf62_2458_6e20_caac_74cc5b46ef22["clear()"]
  fc3a2afd_f371_ac06_cae3_179d416e4835 -->|calls| 9fc1bf62_2458_6e20_caac_74cc5b46ef22
  4fb10322_8b7c_4864_4e5b_818a8cf7ffb7["remove()"]
  fc3a2afd_f371_ac06_cae3_179d416e4835 -->|calls| 4fb10322_8b7c_4864_4e5b_818a8cf7ffb7
  1f6a7e02_7b7f_03ac_277e_7d22f1c6c754["length()"]
  fc3a2afd_f371_ac06_cae3_179d416e4835 -->|calls| 1f6a7e02_7b7f_03ac_277e_7d22f1c6c754
  style fc3a2afd_f371_ac06_cae3_179d416e4835 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/QpackDecoderDynamicTable.java lines 107–149

    void setCapacity(long capacity) throws QpackException {
        if (capacity < MIN_HEADER_TABLE_SIZE || capacity > MAX_HEADER_TABLE_SIZE) {
            throw new IllegalArgumentException("capacity is invalid: " + capacity);
        }
        // initially capacity will be -1 so init won't return here
        if (this.capacity == capacity) {
            return;
        }
        this.capacity = capacity;

        if (capacity == 0) {
            clear();
        } else {
            // initially size will be 0 so remove won't be called
            while (size > capacity) {
                remove();
            }
        }

        int maxEntries = toIntOrThrow(2 * floorDiv(capacity, ENTRY_OVERHEAD));

        // check if capacity change requires us to reallocate the array
        if (fields != null && fields.length == maxEntries) {
            return;
        }

        QpackHeaderField[] tmp = new QpackHeaderField[maxEntries];

        // initially length will be 0 so there will be no copy
        int len = length();
        if (fields != null && tail != head) {
            if (head > tail) {
                System.arraycopy(fields, tail, tmp, 0, head - tail);
            } else {
                System.arraycopy(fields, 0, tmp, 0, head);
                System.arraycopy(fields, tail, tmp, head, fields.length - tail);
            }
        }

        tail = 0;
        head = tail + len;
        fields = tmp;
    }

Domain

Subdomains

Frequently Asked Questions

What does setCapacity() do?
setCapacity() is a function in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/QpackDecoderDynamicTable.java.
Where is setCapacity() defined?
setCapacity() is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/QpackDecoderDynamicTable.java at line 107.
What does setCapacity() call?
setCapacity() calls 3 function(s): clear, length, remove.

Analyze Your Own Codebase

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

Try Supermodel Free