Home / Function/ doWrite() — netty Function Reference

doWrite() — netty Function Reference

Architecture documentation for the doWrite() function in AbstractOioByteChannel.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  59312554_c4bd_9271_bd1e_6ef0f218a046["doWrite()"]
  df30be00_eee6_bc00_48f3_cbf4f80b9065["AbstractOioByteChannel"]
  59312554_c4bd_9271_bd1e_6ef0f218a046 -->|defined in| df30be00_eee6_bc00_48f3_cbf4f80b9065
  f9bde2eb_dd38_8728_f7d0_1eef9cc00d41["doWriteBytes()"]
  59312554_c4bd_9271_bd1e_6ef0f218a046 -->|calls| f9bde2eb_dd38_8728_f7d0_1eef9cc00d41
  49f14135_8a21_cada_5d5d_39e15785aaf9["doWriteFileRegion()"]
  59312554_c4bd_9271_bd1e_6ef0f218a046 -->|calls| 49f14135_8a21_cada_5d5d_39e15785aaf9
  style 59312554_c4bd_9271_bd1e_6ef0f218a046 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/oio/AbstractOioByteChannel.java lines 203–232

    @Override
    protected void doWrite(ChannelOutboundBuffer in) throws Exception {
        for (;;) {
            Object msg = in.current();
            if (msg == null) {
                // nothing left to write
                break;
            }
            if (msg instanceof ByteBuf) {
                ByteBuf buf = (ByteBuf) msg;
                int readableBytes = buf.readableBytes();
                while (readableBytes > 0) {
                    doWriteBytes(buf);
                    int newReadableBytes = buf.readableBytes();
                    in.progress(readableBytes - newReadableBytes);
                    readableBytes = newReadableBytes;
                }
                in.remove();
            } else if (msg instanceof FileRegion) {
                FileRegion region = (FileRegion) msg;
                long transferred = region.transferred();
                doWriteFileRegion(region);
                in.progress(region.transferred() - transferred);
                in.remove();
            } else {
                in.remove(new UnsupportedOperationException(
                        "unsupported message type: " + StringUtil.simpleClassName(msg)));
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does doWrite() do?
doWrite() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/oio/AbstractOioByteChannel.java.
Where is doWrite() defined?
doWrite() is defined in transport/src/main/java/io/netty/channel/oio/AbstractOioByteChannel.java at line 203.
What does doWrite() call?
doWrite() calls 2 function(s): doWriteBytes, doWriteFileRegion.

Analyze Your Own Codebase

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

Try Supermodel Free