doWrite() — netty Function Reference
Architecture documentation for the doWrite() function in OioDatagramChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 5673a17f_23fd_62d7_5a42_47bc9af0e1a5["doWrite()"] a7905bd8_19b4_15f5_a2e6_da0e5df1cc1b["OioDatagramChannel"] 5673a17f_23fd_62d7_5a42_47bc9af0e1a5 -->|defined in| a7905bd8_19b4_15f5_a2e6_da0e5df1cc1b 7965e9d5_f16b_26d1_31ff_7fcce3a3ae28["isConnected()"] 5673a17f_23fd_62d7_5a42_47bc9af0e1a5 -->|calls| 7965e9d5_f16b_26d1_31ff_7fcce3a3ae28 style 5673a17f_23fd_62d7_5a42_47bc9af0e1a5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/socket/oio/OioDatagramChannel.java lines 247–294
@Override
protected void doWrite(ChannelOutboundBuffer in) throws Exception {
for (;;) {
final Object o = in.current();
if (o == null) {
break;
}
final ByteBuf data;
final SocketAddress remoteAddress;
if (o instanceof AddressedEnvelope) {
@SuppressWarnings("unchecked")
AddressedEnvelope<ByteBuf, SocketAddress> envelope = (AddressedEnvelope<ByteBuf, SocketAddress>) o;
remoteAddress = envelope.recipient();
data = envelope.content();
} else {
data = (ByteBuf) o;
remoteAddress = null;
}
final int length = data.readableBytes();
try {
if (remoteAddress != null) {
tmpPacket.setSocketAddress(remoteAddress);
} else {
if (!isConnected()) {
// If not connected we should throw a NotYetConnectedException() to be consistent with
// NioDatagramChannel
throw new NotYetConnectedException();
}
// Ensure we null out the address which may have been set before.
tmpPacket.setAddress(null);
}
if (data.hasArray()) {
tmpPacket.setData(data.array(), data.arrayOffset() + data.readerIndex(), length);
} else {
tmpPacket.setData(ByteBufUtil.getBytes(data, data.readerIndex(), length));
}
socket.send(tmpPacket);
in.remove();
} catch (Exception e) {
// Continue on write error as a DatagramChannel can write to multiple remote peers
//
// See https://github.com/netty/netty/issues/2665
in.remove(e);
}
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does doWrite() do?
doWrite() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/socket/oio/OioDatagramChannel.java.
Where is doWrite() defined?
doWrite() is defined in transport/src/main/java/io/netty/channel/socket/oio/OioDatagramChannel.java at line 247.
What does doWrite() call?
doWrite() calls 1 function(s): isConnected.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free