Home / Function/ reserveAndWriteUtf8Seq() — netty Function Reference

reserveAndWriteUtf8Seq() — netty Function Reference

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

Function java Buffer Allocators calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  e84265cb_1b22_c3e2_66be_7cf9d86140d6["reserveAndWriteUtf8Seq()"]
  920454f6_25f6_4a9b_3d32_9684c3e11f6c["ByteBufUtil"]
  e84265cb_1b22_c3e2_66be_7cf9d86140d6 -->|defined in| 920454f6_25f6_4a9b_3d32_9684c3e11f6c
  1179b53a_e196_1505_4b75_0d4181586259["writeUtf8()"]
  1179b53a_e196_1505_4b75_0d4181586259 -->|calls| e84265cb_1b22_c3e2_66be_7cf9d86140d6
  c7321d53_636f_5f50_ce7c_9264f68c3629["reserveAndWriteUtf8()"]
  c7321d53_636f_5f50_ce7c_9264f68c3629 -->|calls| e84265cb_1b22_c3e2_66be_7cf9d86140d6
  1179b53a_e196_1505_4b75_0d4181586259["writeUtf8()"]
  e84265cb_1b22_c3e2_66be_7cf9d86140d6 -->|calls| 1179b53a_e196_1505_4b75_0d4181586259
  7f1641c7_b9b4_6707_af99_bcc059339c29["getBytes()"]
  e84265cb_1b22_c3e2_66be_7cf9d86140d6 -->|calls| 7f1641c7_b9b4_6707_af99_bcc059339c29
  style e84265cb_1b22_c3e2_66be_7cf9d86140d6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/ByteBufUtil.java lines 881–901

    private static int reserveAndWriteUtf8Seq(ByteBuf buf, CharSequence seq, int start, int end, int reserveBytes) {
        for (;;) {
            if (buf instanceof WrappedCompositeByteBuf) {
                // WrappedCompositeByteBuf is a sub-class of AbstractByteBuf so it needs special handling.
                buf = buf.unwrap();
            } else if (buf instanceof AbstractByteBuf) {
                AbstractByteBuf byteBuf = (AbstractByteBuf) buf;
                byteBuf.ensureWritable0(reserveBytes);
                int written = writeUtf8(byteBuf, byteBuf.writerIndex, reserveBytes, seq, start, end);
                byteBuf.writerIndex += written;
                return written;
            } else if (buf instanceof WrappedByteBuf) {
                // Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
                buf = buf.unwrap();
            } else {
                byte[] bytes = seq.subSequence(start, end).toString().getBytes(CharsetUtil.UTF_8);
                buf.writeBytes(bytes);
                return bytes.length;
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does reserveAndWriteUtf8Seq() do?
reserveAndWriteUtf8Seq() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java.
Where is reserveAndWriteUtf8Seq() defined?
reserveAndWriteUtf8Seq() is defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java at line 881.
What does reserveAndWriteUtf8Seq() call?
reserveAndWriteUtf8Seq() calls 2 function(s): getBytes, writeUtf8.
What calls reserveAndWriteUtf8Seq()?
reserveAndWriteUtf8Seq() is called by 2 function(s): reserveAndWriteUtf8, writeUtf8.

Analyze Your Own Codebase

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

Try Supermodel Free