ByteBuffer.wrap函数

public static ByteBuffer wrap (byte[] array)//这个函数是下个函数的简写特殊版

介绍:Calling this method has the same effect as wrap(array, 0, array.length).


public static ByteBuffer wrap (byte[] array, int start, int byteCount)

The new buffer's position will be start, limit will be start + byteCount, capacity will be the length of the array.

Parameters
array the byte array which the new buffer will be based on.
start the start index, must not be negative and not greater than array.length.
byteCount the length, must not be negative and not greater than array.length - start.
可以看出:新的缓冲区长度为array的长度,实际存储的字节为array的实际字节,新的缓冲区从start开始放入字节,放入的字节长度不能超过原先放过字节剩余的长度。

你可能感兴趣的:(ByteBuffer.wrap函数)