doWriteMessage() — netty Function Reference
Architecture documentation for the doWriteMessage() function in NioSctpChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 1c8038e5_17d1_9428_0f33_fc8c0cfe4928["doWriteMessage()"] ce6c049a_7822_1e77_29fc_0d83a1e2ef54["NioSctpChannel"] 1c8038e5_17d1_9428_0f33_fc8c0cfe4928 -->|defined in| ce6c049a_7822_1e77_29fc_0d83a1e2ef54 style 1c8038e5_17d1_9428_0f33_fc8c0cfe4928 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport-sctp/src/main/java/io/netty/channel/sctp/nio/NioSctpChannel.java lines 311–347
@Override
protected boolean doWriteMessage(Object msg, ChannelOutboundBuffer in) throws Exception {
SctpMessage packet = (SctpMessage) msg;
ByteBuf data = packet.content();
int dataLen = data.readableBytes();
if (dataLen == 0) {
return true;
}
ByteBuffer nioData;
int javaVersion = PlatformDependent.javaVersion();
if (javaVersion >= 22 && javaVersion < 25 && data.isDirect() ||
!data.isDirect() || data.nioBufferCount() != 1) {
// Ensure that we only use a single, direct ByteBuffer when doing SCTP IO.
// If the ByteBuf is composite, or is on-heap, we do a copy.
// On Java 22 through 24, we additionally need to avoid using ByteBuffer instances that are
// backed by MemorySegments, because of https://bugs.openjdk.org/browse/JDK-8357268
if (outputCopy == null || outputCopy.capacity() < dataLen) {
outputCopy = ByteBuffer.allocateDirect(dataLen);
}
outputCopy.clear();
outputCopy.limit(dataLen);
data.readBytes(outputCopy);
outputCopy.flip();
nioData = outputCopy;
} else {
nioData = data.nioBuffer();
}
final MessageInfo mi = MessageInfo.createOutgoing(association(), null, packet.streamIdentifier());
mi.payloadProtocolID(packet.protocolIdentifier());
mi.streamNumber(packet.streamIdentifier());
mi.unordered(packet.isUnordered());
final int writtenBytes = javaChannel().send(nioData, mi);
return writtenBytes > 0;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does doWriteMessage() do?
doWriteMessage() is a function in the netty codebase, defined in transport-sctp/src/main/java/io/netty/channel/sctp/nio/NioSctpChannel.java.
Where is doWriteMessage() defined?
doWriteMessage() is defined in transport-sctp/src/main/java/io/netty/channel/sctp/nio/NioSctpChannel.java at line 311.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free