Home / Class/ PooledSlicedByteBuf Class — netty Architecture

PooledSlicedByteBuf Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  1c63dd5a_5340_a1e3_93d6_2a3433be025a["PooledSlicedByteBuf"]
  7ec97188_e585_48ed_34bf_0e4b853d74d3["PooledSlicedByteBuf.java"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|defined in| 7ec97188_e585_48ed_34bf_0e4b853d74d3
  778eaea9_be2b_fc47_c78f_4b0d94fbfdfb["PooledSlicedByteBuf()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| 778eaea9_be2b_fc47_c78f_4b0d94fbfdfb
  6f6e430d_bf87_7999_c2d6_b07040cb8627["capacity()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| 6f6e430d_bf87_7999_c2d6_b07040cb8627
  24c63ae1_b6fb_a03a_7b4e_b0479aeeade5["ByteBuf()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| 24c63ae1_b6fb_a03a_7b4e_b0479aeeade5
  c6828448_d3ca_980d_e451_d0c241b6e427["arrayOffset()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| c6828448_d3ca_980d_e451_d0c241b6e427
  54a0cfbc_d22f_b8ee_964d_add41a3dbbca["memoryAddress()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| 54a0cfbc_d22f_b8ee_964d_add41a3dbbca
  722264a5_72cf_64a0_d322_0e7ee4f1c748["ByteBuffer()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| 722264a5_72cf_64a0_d322_0e7ee4f1c748
  5c2363b3_b077_f2f9_7220_15f84dfe0507["nioBuffers()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| 5c2363b3_b077_f2f9_7220_15f84dfe0507
  ca10e327_5c29_af2e_8271_a6f00dbecd63["getByte()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| ca10e327_5c29_af2e_8271_a6f00dbecd63
  8607d2b4_4b66_92cb_126f_15c36d59a5ef["_getByte()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| 8607d2b4_4b66_92cb_126f_15c36d59a5ef
  0d459193_f071_c3c9_2adc_65a01297464e["getShort()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| 0d459193_f071_c3c9_2adc_65a01297464e
  3dbed65d_cd8e_ae26_6520_132e78c2fab0["_getShort()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| 3dbed65d_cd8e_ae26_6520_132e78c2fab0
  cd46b24e_dc79_49cf_e032_b91712f8c15a["getShortLE()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| cd46b24e_dc79_49cf_e032_b91712f8c15a
  dae009e4_0200_9751_987c_fc8bf4a3664a["_getShortLE()"]
  1c63dd5a_5340_a1e3_93d6_2a3433be025a -->|method| dae009e4_0200_9751_987c_fc8bf4a3664a

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/PooledSlicedByteBuf.java lines 33–440

final class PooledSlicedByteBuf extends AbstractPooledDerivedByteBuf {

    private static final Recycler<PooledSlicedByteBuf> RECYCLER =
            new Recycler<PooledSlicedByteBuf>() {
                @Override
                protected PooledSlicedByteBuf newObject(Handle<PooledSlicedByteBuf> handle) {
                    return new PooledSlicedByteBuf(handle);
                }
            };

    static PooledSlicedByteBuf newInstance(AbstractByteBuf unwrapped, ByteBuf wrapped,
                                           int index, int length) {
        checkSliceOutOfBounds(index, length, unwrapped);
        return newInstance0(unwrapped, wrapped, index, length);
    }

    private static PooledSlicedByteBuf newInstance0(AbstractByteBuf unwrapped, ByteBuf wrapped,
                                                    int adjustment, int length) {
        final PooledSlicedByteBuf slice = RECYCLER.get();
        slice.init(unwrapped, wrapped, 0, length, length);
        slice.discardMarks();
        slice.adjustment = adjustment;

        return slice;
    }

    int adjustment;

    private PooledSlicedByteBuf(Handle<PooledSlicedByteBuf> handle) {
        super(handle);
    }

    @Override
    public int capacity() {
        return maxCapacity();
    }

    @Override
    public ByteBuf capacity(int newCapacity) {
        throw new UnsupportedOperationException("sliced buffer");
    }

    @Override
    public int arrayOffset() {
        return idx(unwrap().arrayOffset());
    }

    @Override
    public long memoryAddress() {
        return unwrap().memoryAddress() + adjustment;
    }

    @Override
    public ByteBuffer nioBuffer(int index, int length) {
        checkIndex0(index, length);
        return unwrap().nioBuffer(idx(index), length);
    }

    @Override
    public ByteBuffer[] nioBuffers(int index, int length) {
        checkIndex0(index, length);
        return unwrap().nioBuffers(idx(index), length);
    }

    @Override
    public ByteBuf copy(int index, int length) {
        checkIndex0(index, length);
        return unwrap().copy(idx(index), length);
    }

    @Override
    public ByteBuf slice(int index, int length) {
        checkIndex0(index, length);
        return super.slice(idx(index), length);
    }

    @Override
    public ByteBuf retainedSlice(int index, int length) {
        checkIndex0(index, length);
        return PooledSlicedByteBuf.newInstance0(unwrap(), this, idx(index), length);
    }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free