//1.创建缓冲区
ByteBuffer buffer = ByteBuffer.allocate(1024);
System.out.println("position:"+buffer.position()+" limit:"+buffer.limit()+" capacity:"+buffer.capacity());
//2.存放数据
buffer.put("I love java".getBytes());
System.out.println("存放数据后:");
System.out.println("position:"+buffer.position()+" limit:"+buffer.limit
简单测试NIO基本方法
最新推荐文章于 2021-05-15 17:52:46 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)