netty的ByteBuf

来源:互联网 发布:2017年网络暴力事例 编辑:程序博客网 时间:2024/06/06 11:53

netty的ByteBuf
*

 
* +-------------------+------------------+------------------+
* | discardable bytes | readable bytes | writable bytes |
* | | (CONTENT) | |
* +-------------------+------------------+------------------+
* | | | |
* 0 <= readerIndex <= writerIndex <= capacity
*

通过netty的ByteBuf的readerIndex增强对byte的认识;
如果一个ByteBuf的格式是command + status + identifier = 1 + 1 + 4
那么
in.readByte()
in.readByte()
in.readInt() 这个就是4个Byte的长度即4*8=32位长度,所以,int是占32位;

0 0
原创粉丝点击