Home / Function/ readBytes() — netty Function Reference

readBytes() — netty Function Reference

Architecture documentation for the readBytes() function in ByteBufUtil.java from the netty codebase.

Function java Buffer Search calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  d4698b7c_2291_aecb_8583_ae5e525a1a22["readBytes()"]
  920454f6_25f6_4a9b_3d32_9684c3e11f6c["ByteBufUtil"]
  d4698b7c_2291_aecb_8583_ae5e525a1a22 -->|defined in| 920454f6_25f6_4a9b_3d32_9684c3e11f6c
  a25efb62_fa62_08c5_238f_d23c15a3569b["ByteBuf()"]
  a25efb62_fa62_08c5_238f_d23c15a3569b -->|calls| d4698b7c_2291_aecb_8583_ae5e525a1a22
  7f1641c7_b9b4_6707_af99_bcc059339c29["getBytes()"]
  d4698b7c_2291_aecb_8583_ae5e525a1a22 -->|calls| 7f1641c7_b9b4_6707_af99_bcc059339c29
  5aa64bba_7190_3430_6812_affa2bbfb849["threadLocalTempArray()"]
  d4698b7c_2291_aecb_8583_ae5e525a1a22 -->|calls| 5aa64bba_7190_3430_6812_affa2bbfb849
  style d4698b7c_2291_aecb_8583_ae5e525a1a22 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/ByteBufUtil.java lines 1970–1992

    static void readBytes(ByteBufAllocator allocator, ByteBuffer buffer, int position, int length, OutputStream out)
            throws IOException {
        if (buffer.hasArray()) {
            out.write(buffer.array(), position + buffer.arrayOffset(), length);
        } else {
            int chunkLen = Math.min(length, WRITE_CHUNK_SIZE);
            buffer.clear().position(position).limit(position + length);

            if (length <= MAX_TL_ARRAY_LEN || !allocator.isDirectBufferPooled()) {
                getBytes(buffer, threadLocalTempArray(chunkLen), 0, chunkLen, out, length);
            } else {
                // if direct buffers are pooled chances are good that heap buffers are pooled as well.
                ByteBuf tmpBuf = allocator.heapBuffer(chunkLen);
                try {
                    byte[] tmp = tmpBuf.array();
                    int offset = tmpBuf.arrayOffset();
                    getBytes(buffer, tmp, offset, chunkLen, out, length);
                } finally {
                    tmpBuf.release();
                }
            }
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does readBytes() do?
readBytes() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java.
Where is readBytes() defined?
readBytes() is defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java at line 1970.
What does readBytes() call?
readBytes() calls 2 function(s): getBytes, threadLocalTempArray.
What calls readBytes()?
readBytes() is called by 1 function(s): ByteBuf.

Analyze Your Own Codebase

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

Try Supermodel Free