Home / Function/ Component() — netty Function Reference

Component() — netty Function Reference

Architecture documentation for the Component() function in CompositeByteBuf.java from the netty codebase.

Function java Buffer Telemetry calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  1c7dc7e4_3e5b_2e66_7101_f504f6948f2b["Component()"]
  6b8e4d93_5aed_4ff7_ccdd_9c021b0fe7d6["CompositeByteBuf"]
  1c7dc7e4_3e5b_2e66_7101_f504f6948f2b -->|defined in| 6b8e4d93_5aed_4ff7_ccdd_9c021b0fe7d6
  c43bd811_d298_9424_d7d9_f55cb58a89e1["Component()"]
  c43bd811_d298_9424_d7d9_f55cb58a89e1 -->|calls| 1c7dc7e4_3e5b_2e66_7101_f504f6948f2b
  d3be0b0f_c8ba_dc16_970f_8a5302e005af["idx()"]
  1c7dc7e4_3e5b_2e66_7101_f504f6948f2b -->|calls| d3be0b0f_c8ba_dc16_970f_8a5302e005af
  8b40bcf2_a1f9_fa88_113f_04b3bb1e18c3["capacity()"]
  1c7dc7e4_3e5b_2e66_7101_f504f6948f2b -->|calls| 8b40bcf2_a1f9_fa88_113f_04b3bb1e18c3
  c43bd811_d298_9424_d7d9_f55cb58a89e1["Component()"]
  1c7dc7e4_3e5b_2e66_7101_f504f6948f2b -->|calls| c43bd811_d298_9424_d7d9_f55cb58a89e1
  style 1c7dc7e4_3e5b_2e66_7101_f504f6948f2b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java lines 319–348

    @SuppressWarnings("deprecation")
    private Component newComponent(final ByteBuf buf, final int offset) {
        final int srcIndex = buf.readerIndex();
        final int len = buf.readableBytes();

        // unpeel any intermediate outer layers (UnreleasableByteBuf, LeakAwareByteBufs, SwappedByteBuf)
        ByteBuf unwrapped = buf;
        int unwrappedIndex = srcIndex;
        while (unwrapped instanceof WrappedByteBuf || unwrapped instanceof SwappedByteBuf) {
            unwrapped = unwrapped.unwrap();
        }

        // unwrap if already sliced
        if (unwrapped instanceof AbstractUnpooledSlicedByteBuf) {
            unwrappedIndex += ((AbstractUnpooledSlicedByteBuf) unwrapped).idx(0);
            unwrapped = unwrapped.unwrap();
        } else if (unwrapped instanceof PooledSlicedByteBuf) {
            unwrappedIndex += ((PooledSlicedByteBuf) unwrapped).adjustment;
            unwrapped = unwrapped.unwrap();
        } else if (unwrapped instanceof DuplicatedByteBuf || unwrapped instanceof PooledDuplicatedByteBuf) {
            unwrapped = unwrapped.unwrap();
        }

        // We don't need to slice later to expose the internal component if the readable range
        // is already the entire buffer
        final ByteBuf slice = buf.capacity() == len ? buf : null;

        return new Component(buf.order(ByteOrder.BIG_ENDIAN), srcIndex,
                unwrapped.order(ByteOrder.BIG_ENDIAN), unwrappedIndex, offset, len, slice);
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does Component() do?
Component() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java.
Where is Component() defined?
Component() is defined in buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java at line 319.
What does Component() call?
Component() calls 3 function(s): Component, capacity, idx.
What calls Component()?
Component() is called by 1 function(s): Component.

Analyze Your Own Codebase

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

Try Supermodel Free