nio-Buffer
来源:互联网 发布:json文件dw打开乱码 编辑:程序博客网 时间:2024/05/16 08:54
Buffer属性
capacity: buffer的容量
A buffer's capacity is the number of elements it contains. The capacity of a buffer is never negative and never changes. limit: 写时limit=capacity,读时limit=buffer内数据的长度
A buffer's limit is the index of the first element that should not be read or written. A buffer's limit is never negative and is never greater than its capacity. position:下一个读写的位置
A buffer's position is the index of the next element to be read or written. A buffer's position is never negative and is never greater than its limit.
Buffer方法
flip:
把limit设为当前position,把position设为0,一般在从Buffer读出数据前调用。
public final Buffer flip() { limit = position; position = 0; mark = -1; return this;}clear:把position设为0,把limit设为capacity,一般在把数据写入Buffer前调用。
public final Buffer clear() { position = 0; limit = capacity; mark = -1; return this;}rewind:把position设为0,limit不变,一般在把数据重写入Buffer前调用。public final Buffer rewind() { position = 0; mark = -1; return this;}
0 0
- NIO Buffer
- NIO buffer
- NIO - Buffer
- nio-Buffer
- NIO buffer
- NIO - Buffer
- NIO - Buffer
- NIO - Buffer
- NIO BUFFER
- NIO Buffer
- NIO Buffer
- NIO ----Buffer
- nio.Buffer
- java nio之Buffer
- java.nio.Buffer分析
- java.nio.Buffer分析
- nio之Buffer系列
- nio.Buffer小记
- Java参数传递
- centos linux 编译安装pcre软件
- 基数排序
- android studio 获取sha1 和 md5 的值
- 46. Permutations
- nio-Buffer
- 动态代理模式
- 初涉RxAndroid .from() .just() 以及线程操作
- 初学processing(一)
- easyUI 转为中文
- 用beeline连接SparkSQL
- 网络基础---子网掩码
- 1000行代码写小游戏(八)
- Android引入外部数据库遇到的坑