io.netty.ByteBuf writeBytes(java.nio.ByteBuffer src) APIclarification

I wanted to know how many memory copies are involved in the below writeBytes API from io.netty.buffer.ByteBuf Interface. Will the data gets copied to an intermediate byte array before getting transferred to Bytebuf ? or will the data directly gets copied from backing array of nio.ByteBuffer to ButeBuf ? or will it depend on type of nio.ByteBuffer supplied

Note i am supplying a read-only ByteBuffer as a parameter.

API writeBytes(java.nio.ByteBuffer src)

Add Comment
1 Answer(s)

This is an implementation detail and so there are no real guarantees. That said we try to minimise the memory copies as much as possible within Netty.

Answered on July 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.