Kuba Spatny
06/18/2025, 3:28 PMOutgoingContent.WriteChannelContent() where I could directly write into channel: ByteWriteChannel.
Is there a way to do that in Ktor 3?
- ByteWriter.writeBuffer is marked as @InternalAPI, as are all the write operations in ByteWriteChannelOperations.kt.
- ByteWriteChannel.asSink() is only available for jvmAndPosix
For now, the only solution I found was to use OutgoingContent.ByteArrayContent() instead. Thanks for any pointers!Aleksei Tirman [JB]
06/19/2025, 6:20 AMobject : OutgoingContent.WriteChannelContent() {
override suspend fun writeTo(channel: ByteWriteChannel) {
channel.writeStringUtf8("Hello")
channel.writeByteArray(ByteArray(0))
}
}Kuba Spatny
06/19/2025, 3:35 PMwriteBuffer in ByteWriteChannel is marked @InternalAPI. Then when looking at the functions such as writeStringUtf8 I didn't notice it was marked @OptIn(InternalAPI::class) not @InternalAPI .