Skip to content

Commit

Permalink
Merge pull request #33 from waylau/fix-bytebuf
Browse files Browse the repository at this point in the history
fix:ByteBuf的描述
  • Loading branch information
waylau committed Jun 28, 2020
2 parents 58dbf6c + 764f6fd commit 8923a29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CORE FUNCTIONS/ByteBuf - The byte data container.md
Expand Up @@ -96,7 +96,7 @@ Netty 提供了 ByteBuf 的子类 CompositeByteBuf 类来处理复合缓冲区

*警告*

*CompositeByteBuf.hasArray() 总是返回 false,因为它可能既包含堆缓冲区,也包含直接缓冲区*
*CompositeByteBuf中的ByteBuf实例可能既包含堆缓冲区,也包含直接缓冲区。因此,如果只有一个实例,那么在CompositeByteBuf上调用hasArray()方法将返回该组件的hasArray()的值。否则将返回false。*

例如,一条消息由 header 和 body 两部分组成,将 header 和 body 组装成一条消息发送出去,可能 body 相同,只是 header 不同,使用CompositeByteBuf 就不用每次都重新分配一个新的缓冲区。下图显示CompositeByteBuf 组成 header 和 body:

Expand Down

0 comments on commit 8923a29

Please sign in to comment.