Home / Class/ Unpooled Class — netty Architecture

Unpooled Class — netty Architecture

Architecture documentation for the Unpooled class in Unpooled.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b8541b6d_5751_4da2_7cbe_c16222454c11["Unpooled"]
  bb21d997_6ecb_65f8_131a_cdc4db97b6ae["Unpooled.java"]
  b8541b6d_5751_4da2_7cbe_c16222454c11 -->|defined in| bb21d997_6ecb_65f8_131a_cdc4db97b6ae
  363bc59d_4fbf_6799_a695_80b5773c676a["ByteBuf()"]
  b8541b6d_5751_4da2_7cbe_c16222454c11 -->|method| 363bc59d_4fbf_6799_a695_80b5773c676a
  2489c944_f585_6b44_aa22_ed4a076e949e["CompositeByteBuf()"]
  b8541b6d_5751_4da2_7cbe_c16222454c11 -->|method| 2489c944_f585_6b44_aa22_ed4a076e949e
  b9d18991_1ab7_a5a7_f408_eec2836bed19["ReadOnlyByteBuf()"]
  b8541b6d_5751_4da2_7cbe_c16222454c11 -->|method| b9d18991_1ab7_a5a7_f408_eec2836bed19
  726f4338_9a2b_44ed_6079_ff8ffeb24478["Unpooled()"]
  b8541b6d_5751_4da2_7cbe_c16222454c11 -->|method| 726f4338_9a2b_44ed_6079_ff8ffeb24478

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/Unpooled.java lines 73–933

public final class Unpooled {

    private static final ByteBufAllocator ALLOC = UnpooledByteBufAllocator.DEFAULT;

    /**
     * Big endian byte order.
     */
    public static final ByteOrder BIG_ENDIAN = ByteOrder.BIG_ENDIAN;

    /**
     * Little endian byte order.
     */
    public static final ByteOrder LITTLE_ENDIAN = ByteOrder.LITTLE_ENDIAN;

    /**
     * A buffer whose capacity is {@code 0}.
     */
    @SuppressWarnings("checkstyle:StaticFinalBuffer")  // EmptyByteBuf is not writeable or readable.
    public static final ByteBuf EMPTY_BUFFER = ALLOC.buffer(0, 0);

    static {
        assert EMPTY_BUFFER instanceof EmptyByteBuf: "EMPTY_BUFFER must be an EmptyByteBuf.";
    }

    /**
     * Creates a new big-endian Java heap buffer with reasonably small initial capacity, which
     * expands its capacity boundlessly on demand.
     */
    public static ByteBuf buffer() {
        return ALLOC.heapBuffer();
    }

    /**
     * Creates a new big-endian direct buffer with reasonably small initial capacity, which
     * expands its capacity boundlessly on demand.
     */
    public static ByteBuf directBuffer() {
        return ALLOC.directBuffer();
    }

    /**
     * Creates a new big-endian Java heap buffer with the specified {@code capacity}, which
     * expands its capacity boundlessly on demand.  The new buffer's {@code readerIndex} and
     * {@code writerIndex} are {@code 0}.
     */
    public static ByteBuf buffer(int initialCapacity) {
        return ALLOC.heapBuffer(initialCapacity);
    }

    /**
     * Creates a new big-endian direct buffer with the specified {@code capacity}, which
     * expands its capacity boundlessly on demand.  The new buffer's {@code readerIndex} and
     * {@code writerIndex} are {@code 0}.
     */
    public static ByteBuf directBuffer(int initialCapacity) {
        return ALLOC.directBuffer(initialCapacity);
    }

    /**
     * Creates a new big-endian Java heap buffer with the specified
     * {@code initialCapacity}, that may grow up to {@code maxCapacity}
     * The new buffer's {@code readerIndex} and {@code writerIndex} are
     * {@code 0}.
     */
    public static ByteBuf buffer(int initialCapacity, int maxCapacity) {
        return ALLOC.heapBuffer(initialCapacity, maxCapacity);
    }

    /**
     * Creates a new big-endian direct buffer with the specified
     * {@code initialCapacity}, that may grow up to {@code maxCapacity}.
     * The new buffer's {@code readerIndex} and {@code writerIndex} are
     * {@code 0}.
     */
    public static ByteBuf directBuffer(int initialCapacity, int maxCapacity) {
        return ALLOC.directBuffer(initialCapacity, maxCapacity);
    }

    /**
     * Creates a new big-endian buffer which wraps the specified {@code array}.
     * A modification on the specified array's content will be visible to the

Frequently Asked Questions

What is the Unpooled class?
Unpooled is a class in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/Unpooled.java.
Where is Unpooled defined?
Unpooled is defined in buffer/src/main/java/io/netty/buffer/Unpooled.java at line 73.

Analyze Your Own Codebase

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

Try Supermodel Free