1. Buffer类的说明

nio入门一(Buffer类的使用)

2. Buffer类的API

nio入门一(Buffer类的使用)

3. Buffer类的API使用,介绍子类ByteBuffer

1.创建对象和capacity的概念

ByteBuffer byteBuffer3 = ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5 });
System.out.println(byteBuffer3);

输出结果如下:

java.nio.HeapByteBuffer[pos=0 lim=5 cap=5]

查看源码如下:
nio入门一(Buffer类的使用)
capacity的解释
A buffer’s capacity is the number of elements it contains. The capacity of a buffer is never negative and never changes.

相关文章:

  • 2021-05-22
  • 2022-12-23
  • 2022-02-09
  • 2021-06-03
  • 2021-09-30
  • 2022-01-19
  • 2021-10-01
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2022-03-05
  • 2022-12-23
  • 2021-12-10
  • 2021-07-20
  • 2021-11-25
  • 2021-05-25
相关资源
相似解决方案