Use Buffer class

1, 7 and since Buffer subclasses are abstract classes, it can not be directly instantiated new, it needs the static method wrap () The 7 data types of array package into buffer.

例:ByteBuffer bytebuffer = ByteBuffer.wrap(new byte[] {1,2,3});

 

2, there are four core buffer technical points:

(1) capacity ( Capacity ): buffer contains the number of elements, it can not be negative, and can not change.

(2) limit ( limitation )

(3) position ( position )

(4) mark ( mark )

 

3、0 <= mark <= position <= limit <= capacity

 

4, int capacity (): Returns the size of this buffer.

Guess you like

Origin www.cnblogs.com/xy80hou/p/11106005.html