Home / Class/ ByteBuf Class — netty Architecture

ByteBuf Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  90086a6a_271d_b5b8_bcd2_f6b741e8132e["ByteBuf"]
  6937aaec_f4fc_a0d0_1286_2fb5947ed06a["ByteBuf.java"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|defined in| 6937aaec_f4fc_a0d0_1286_2fb5947ed06a
  a4c3e9ac_00cd_e58b_4a72_a900eaf1901a["capacity()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| a4c3e9ac_00cd_e58b_4a72_a900eaf1901a
  f5a7fa59_b66a_3e32_db3f_bd0803e39408["ByteBuf()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| f5a7fa59_b66a_3e32_db3f_bd0803e39408
  6cdb9516_caac_9d51_e1e6_11cb6e29736e["maxCapacity()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| 6cdb9516_caac_9d51_e1e6_11cb6e29736e
  241be734_8883_ef95_15bf_611430af7f44["ByteBufAllocator()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| 241be734_8883_ef95_15bf_611430af7f44
  bd8bc97c_3f7b_f656_6cd2_673a6d731263["ByteOrder()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| bd8bc97c_3f7b_f656_6cd2_673a6d731263
  dc57463d_b058_1ee5_c42d_ec52ebd7d75e["isDirect()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| dc57463d_b058_1ee5_c42d_ec52ebd7d75e
  691ce48a_29e1_9f46_53e5_e55ea8833159["isReadOnly()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| 691ce48a_29e1_9f46_53e5_e55ea8833159
  96e9ded3_b3d2_e702_5fb0_4272edf78218["readerIndex()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| 96e9ded3_b3d2_e702_5fb0_4272edf78218
  2c895dab_33fe_1a05_32c7_88156dedb356["writerIndex()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| 2c895dab_33fe_1a05_32c7_88156dedb356
  780716e0_1a87_6cf9_a151_c6152936767a["readableBytes()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| 780716e0_1a87_6cf9_a151_c6152936767a
  0aafac6c_2d75_5675_a72b_de51a9978dc8["writableBytes()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| 0aafac6c_2d75_5675_a72b_de51a9978dc8
  0c0488f4_8645_97ac_a48d_cebf8566171f["maxWritableBytes()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| 0c0488f4_8645_97ac_a48d_cebf8566171f
  163e32f5_6166_22b5_970c_fa474dae00a4["maxFastWritableBytes()"]
  90086a6a_271d_b5b8_bcd2_f6b741e8132e -->|method| 163e32f5_6166_22b5_970c_fa474dae00a4

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/ByteBuf.java lines 248–2508

public abstract class ByteBuf implements ReferenceCounted, Comparable<ByteBuf>, ByteBufConvertible {

    /**
     * Returns the number of bytes (octets) this buffer can contain.
     */
    public abstract int capacity();

    /**
     * Adjusts the capacity of this buffer.  If the {@code newCapacity} is less than the current
     * capacity, the content of this buffer is truncated.  If the {@code newCapacity} is greater
     * than the current capacity, the buffer is appended with unspecified data whose length is
     * {@code (newCapacity - currentCapacity)}.
     *
     * @throws IllegalArgumentException if the {@code newCapacity} is greater than {@link #maxCapacity()}
     */
    public abstract ByteBuf capacity(int newCapacity);

    /**
     * Returns the maximum allowed capacity of this buffer. This value provides an upper
     * bound on {@link #capacity()}.
     */
    public abstract int maxCapacity();

    /**
     * Returns the {@link ByteBufAllocator} which created this buffer.
     */
    public abstract ByteBufAllocator alloc();

    /**
     * Returns the <a href="https://en.wikipedia.org/wiki/Endianness">endianness</a>
     * of this buffer.
     *
     * @deprecated use the Little Endian accessors, e.g. {@code getShortLE}, {@code getIntLE}
     * instead of creating a buffer with swapped {@code endianness}.
     */
    @Deprecated
    public abstract ByteOrder order();

    /**
     * Returns a buffer with the specified {@code endianness} which shares the whole region,
     * indexes, and marks of this buffer.  Modifying the content, the indexes, or the marks of the
     * returned buffer or this buffer affects each other's content, indexes, and marks.  If the
     * specified {@code endianness} is identical to this buffer's byte order, this method can
     * return {@code this}.  This method does not modify {@code readerIndex} or {@code writerIndex}
     * of this buffer.
     *
     * @deprecated use the Little Endian accessors, e.g. {@code getShortLE}, {@code getIntLE}
     * instead of creating a buffer with swapped {@code endianness}.
     */
    @Deprecated
    public abstract ByteBuf order(ByteOrder endianness);

    /**
     * Return the underlying buffer instance if this buffer is a wrapper of another buffer.
     *
     * @return {@code null} if this buffer is not a wrapper
     */
    public abstract ByteBuf unwrap();

    /**
     * Returns {@code true} if and only if this buffer is backed by an
     * NIO direct buffer.
     */
    public abstract boolean isDirect();

    /**
     * Returns {@code true} if and only if this buffer is read-only.
     */
    public abstract boolean isReadOnly();

    /**
     * Returns a read-only version of this buffer.
     */
    public abstract ByteBuf asReadOnly();

    /**
     * Returns the {@code readerIndex} of this buffer.
     */
    public abstract int readerIndex();

    /**

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free