简体   繁体   English

io.netty.ByteBuf writeBytes(java.nio.ByteBuffer src) API说明

[英]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.我想知道下面来自 io.netty.buffer.ByteBuf 接口的 writeBytes API 涉及多少个 memory 副本。 Will the data gets copied to an intermediate byte array before getting transferred to Bytebuf?在传输到 Bytebuf 之前,数据会被复制到中间字节数组吗? or will the data directly gets copied from backing array of nio.ByteBuffer to ButeBuf?还是将数据直接从 nio.ByteBuffer 的支持数组复制到 ButeBuf? or will it depend on type of nio.ByteBuffer supplied还是取决于提供的 nio.ByteBuffer 类型

Note i am supplying a read-only ByteBuffer as a parameter.请注意,我提供了一个只读 ByteBuffer 作为参数。

API writeBytes(java.nio.ByteBuffer src) API writeBytes(java.nio.ByteBuffer src)

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.也就是说,我们尝试在 Netty 中尽可能减少 memory 副本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM