Home / Function/ nioBuffers() — netty Function Reference

nioBuffers() — netty Function Reference

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

Function java Buffer Allocators calls 3 called by 2

Entity Profile

Dependency Diagram

graph TD
  4b8806f4_7999_2590_e28e_7826721fada3["nioBuffers()"]
  6b8e4d93_5aed_4ff7_ccdd_9c021b0fe7d6["CompositeByteBuf"]
  4b8806f4_7999_2590_e28e_7826721fada3 -->|defined in| 6b8e4d93_5aed_4ff7_ccdd_9c021b0fe7d6
  ef81abf8_e155_b7e4_fb6e_952e0170c90f["getBytes()"]
  ef81abf8_e155_b7e4_fb6e_952e0170c90f -->|calls| 4b8806f4_7999_2590_e28e_7826721fada3
  67892dec_e805_f85c_7c2a_6a7023a18ba2["ByteBuffer()"]
  67892dec_e805_f85c_7c2a_6a7023a18ba2 -->|calls| 4b8806f4_7999_2590_e28e_7826721fada3
  56df3e62_e22d_e17d_1a00_60ba703c8e92["toComponentIndex0()"]
  4b8806f4_7999_2590_e28e_7826721fada3 -->|calls| 56df3e62_e22d_e17d_1a00_60ba703c8e92
  0cc881c8_53ab_8ded_30ad_3bb95c4880ab["nioBufferCount()"]
  4b8806f4_7999_2590_e28e_7826721fada3 -->|calls| 0cc881c8_53ab_8ded_30ad_3bb95c4880ab
  d3be0b0f_c8ba_dc16_970f_8a5302e005af["idx()"]
  4b8806f4_7999_2590_e28e_7826721fada3 -->|calls| d3be0b0f_c8ba_dc16_970f_8a5302e005af
  style 4b8806f4_7999_2590_e28e_7826721fada3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java lines 1718–1751

    @Override
    public ByteBuffer[] nioBuffers(int index, int length) {
        checkIndex(index, length);
        if (length == 0) {
            return new ByteBuffer[] { EMPTY_NIO_BUFFER };
        }

        RecyclableArrayList buffers = RecyclableArrayList.newInstance(componentCount);
        try {
            int i = toComponentIndex0(index);
            while (length > 0) {
                Component c = components[i];
                ByteBuf s = c.buf;
                int localLength = Math.min(length, c.endOffset - index);
                switch (s.nioBufferCount()) {
                case 0:
                    throw new UnsupportedOperationException();
                case 1:
                    buffers.add(s.nioBuffer(c.idx(index), localLength));
                    break;
                default:
                    Collections.addAll(buffers, s.nioBuffers(c.idx(index), localLength));
                }

                index += localLength;
                length -= localLength;
                i ++;
            }

            return buffers.toArray(EmptyArrays.EMPTY_BYTE_BUFFERS);
        } finally {
            buffers.recycle();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does nioBuffers() do?
nioBuffers() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java.
Where is nioBuffers() defined?
nioBuffers() is defined in buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java at line 1718.
What does nioBuffers() call?
nioBuffers() calls 3 function(s): idx, nioBufferCount, toComponentIndex0.
What calls nioBuffers()?
nioBuffers() is called by 2 function(s): ByteBuffer, getBytes.

Analyze Your Own Codebase

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

Try Supermodel Free