Home / Function/ toComponentIndex0() — netty Function Reference

toComponentIndex0() — netty Function Reference

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

Function java Buffer Search called by 8

Entity Profile

Dependency Diagram

graph TD
  56df3e62_e22d_e17d_1a00_60ba703c8e92["toComponentIndex0()"]
  6b8e4d93_5aed_4ff7_ccdd_9c021b0fe7d6["CompositeByteBuf"]
  56df3e62_e22d_e17d_1a00_60ba703c8e92 -->|defined in| 6b8e4d93_5aed_4ff7_ccdd_9c021b0fe7d6
  e9920c4e_d91d_be1d_34e0_9c0ddc060f5d["CompositeByteBuf()"]
  e9920c4e_d91d_be1d_34e0_9c0ddc060f5d -->|calls| 56df3e62_e22d_e17d_1a00_60ba703c8e92
  f50369e1_0d88_4063_7d0a_03ac290b1e6d["forEachByteAsc0()"]
  f50369e1_0d88_4063_7d0a_03ac290b1e6d -->|calls| 56df3e62_e22d_e17d_1a00_60ba703c8e92
  feafa28f_9555_7306_d9ec_7f16713f1981["forEachByteDesc0()"]
  feafa28f_9555_7306_d9ec_7f16713f1981 -->|calls| 56df3e62_e22d_e17d_1a00_60ba703c8e92
  ec10a321_3746_2625_f943_7b713dc3b73d["decompose()"]
  ec10a321_3746_2625_f943_7b713dc3b73d -->|calls| 56df3e62_e22d_e17d_1a00_60ba703c8e92
  8583c54c_efe2_c6b7_718c_b1c876b1440f["toComponentIndex()"]
  8583c54c_efe2_c6b7_718c_b1c876b1440f -->|calls| 56df3e62_e22d_e17d_1a00_60ba703c8e92
  58ef5d22_93d0_55a5_4256_c3bde8df53ef["setBytes()"]
  58ef5d22_93d0_55a5_4256_c3bde8df53ef -->|calls| 56df3e62_e22d_e17d_1a00_60ba703c8e92
  ab122f34_311d_08f3_ea76_dfd965d4ae24["ByteBuf()"]
  ab122f34_311d_08f3_ea76_dfd965d4ae24 -->|calls| 56df3e62_e22d_e17d_1a00_60ba703c8e92
  4b8806f4_7999_2590_e28e_7826721fada3["nioBuffers()"]
  4b8806f4_7999_2590_e28e_7826721fada3 -->|calls| 56df3e62_e22d_e17d_1a00_60ba703c8e92
  style 56df3e62_e22d_e17d_1a00_60ba703c8e92 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java lines 920–945

    private int toComponentIndex0(int offset) {
        int size = componentCount;
        if (offset == 0) { // fast-path zero offset
            for (int i = 0; i < size; i++) {
                if (components[i].endOffset > 0) {
                    return i;
                }
            }
        }
        if (size <= 2) { // fast-path for 1 and 2 component count
            return size == 1 || offset < components[0].endOffset ? 0 : 1;
        }
        for (int low = 0, high = size; low <= high;) {
            int mid = low + high >>> 1;
            Component c = components[mid];
            if (offset >= c.endOffset) {
                low = mid + 1;
            } else if (offset < c.offset) {
                high = mid - 1;
            } else {
                return mid;
            }
        }

        throw new Error("should not reach here");
    }

Domain

Subdomains

Frequently Asked Questions

What does toComponentIndex0() do?
toComponentIndex0() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java.
Where is toComponentIndex0() defined?
toComponentIndex0() is defined in buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java at line 920.
What calls toComponentIndex0()?
toComponentIndex0() is called by 8 function(s): ByteBuf, CompositeByteBuf, decompose, forEachByteAsc0, forEachByteDesc0, nioBuffers, setBytes, toComponentIndex.

Analyze Your Own Codebase

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

Try Supermodel Free