Buffer的基本用法

来源:互联网 发布:python time.strftime 编辑:程序博客网 时间:2024/05/28 15:35

1、对buffe.put(**)后,都要buffer.flip();使limit设为当前位置(buffer最后位),且把position设为0。

 

2、byte[] b = new byte[buffer.remaining()];

把buffer.长度作为新new的b的长度