Home / Function/ ByteBuf() — netty Function Reference

ByteBuf() — netty Function Reference

Architecture documentation for the ByteBuf() function in PooledByteBuf.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3d31b84b_29ad_88f5_6a79_fe73056f1dc5["ByteBuf()"]
  49d00ede_f018_5e8f_42f9_08fdd974fe00["PooledByteBuf"]
  3d31b84b_29ad_88f5_6a79_fe73056f1dc5 -->|defined in| 49d00ede_f018_5e8f_42f9_08fdd974fe00
  e4b2bb2e_61b6_e965_f924_7b6426462c6f["capacity()"]
  3d31b84b_29ad_88f5_6a79_fe73056f1dc5 -->|calls| e4b2bb2e_61b6_e965_f924_7b6426462c6f
  style 3d31b84b_29ad_88f5_6a79_fe73056f1dc5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/PooledByteBuf.java lines 101–128

    @Override
    public final ByteBuf capacity(int newCapacity) {
        if (newCapacity == length) {
            ensureAccessible();
            return this;
        }
        checkNewCapacity(newCapacity);
        if (!chunk.unpooled) {
            // If the request capacity does not require reallocation, just update the length of the memory.
            if (newCapacity > length) {
                if (newCapacity <= maxLength) {
                    length = newCapacity;
                    return this;
                }
            } else if (newCapacity > maxLength >>> 1 &&
                    (maxLength > 512 || newCapacity > maxLength - 16)) {
                // here newCapacity < length
                length = newCapacity;
                trimIndicesToCapacity(newCapacity);
                return this;
            }
        }

        // Reallocation required.
        PooledByteBufAllocator.onReallocateBuffer(this, newCapacity);
        chunk.arena.reallocate(this, newCapacity);
        return this;
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does ByteBuf() do?
ByteBuf() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/PooledByteBuf.java.
Where is ByteBuf() defined?
ByteBuf() is defined in buffer/src/main/java/io/netty/buffer/PooledByteBuf.java at line 101.
What does ByteBuf() call?
ByteBuf() calls 1 function(s): capacity.

Analyze Your Own Codebase

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

Try Supermodel Free