java.lang.Object
cn.wjybxx.base.io.ByteBufferUtils
- 作者:
- wjybxx date - 2024/1/6
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidcheckBuffer(byte[] buffer, int offset, int length) 检查buffer参数static voidcheckBuffer(int bufferLength, int offset) 检查buffer参数static voidcheckBuffer(int bufferLength, int offset, int length) 检查buffer参数static bytegetByte(byte[] buffer, int index) static shortgetInt16(byte[] buffer, int index) 大端:从buffer中读取一个Int16static shortgetInt16LE(byte[] buffer, int index) 小端:从buffer中读取一个Int16static intgetInt32(byte[] buffer, int index) 大端:从buffer中读取一个Int32static intgetInt32LE(byte[] buffer, int index) 小端:从buffer中读取一个Int32static longgetInt64(byte[] buffer, int index) 大端:从buffer中读取一个Int64static longgetInt64LE(byte[] buffer, int index) 小端:从buffer中读取一个Int64static longgetUInt32(byte[] buffer, int index) 大端:从buffer中读取一个Int32static longgetUInt32LE(byte[] buffer, int index) 小端:从buffer中读取一个Int32static longgetUInt48(byte[] buffer, int index) 大端:从buffer中读取一个UInt48static longgetUInt48LE(byte[] buffer, int index) 小端:从buffer中读取一个Int48static intgetUnsignedByte(byte[] buffer, int index) static voidJDK9+的代码跑在JDK8上的兼容问题static voidsetByte(byte[] buffer, int index, byte value) static voidsetByte(byte[] buffer, int index, int value) static voidsetInt16(byte[] buffer, int index, short value) 大端:向buffer中写入一个Int16static voidsetInt16LE(byte[] buffer, int index, short value) 小端:向buffer中写入一个Int16static voidsetInt32(byte[] buffer, int index, int value) 大端:向buffer中写入一个Int32static voidsetInt32LE(byte[] buffer, int index, int value) 小端:向buffer中写入一个Int32static voidsetInt64(byte[] buffer, int index, long value) 大端:向buffer中写入一个Int64static voidsetInt64LE(byte[] buffer, int index, long value) 小端:向buffer中写入一个Int64static voidsetUInt32(byte[] buffer, int index, long value) 大端:向buffer中写入一个Int32static voidsetUInt32LE(byte[] buffer, int index, long value) 小端:向buffer中写入一个Int32static voidsetUInt48(byte[] buffer, int index, long value) 大端:向buffer中写入一个UInt48static voidsetUInt48LE(byte[] buffer, int index, long value) 小端:向buffer中写入一个Int48
-
构造器详细资料
-
ByteBufferUtils
public ByteBufferUtils()
-
-
方法详细资料
-
checkBuffer
public static void checkBuffer(byte[] buffer, int offset, int length) 检查buffer参数- 参数:
buffer- 要检查的数组offset- 数据的起始索引length- 数据的长度
-
checkBuffer
public static void checkBuffer(int bufferLength, int offset, int length) 检查buffer参数- 参数:
bufferLength- buffer数组的长度offset- 数据的起始索引length- 数据的长度
-
checkBuffer
public static void checkBuffer(int bufferLength, int offset) 检查buffer参数- 参数:
bufferLength- buffer数组的长度offset- 数据的起始索引
-
position
JDK9+的代码跑在JDK8上的兼容问题 -
getByte
public static byte getByte(byte[] buffer, int index) -
setByte
public static void setByte(byte[] buffer, int index, byte value) -
getUnsignedByte
public static int getUnsignedByte(byte[] buffer, int index) -
setByte
public static void setByte(byte[] buffer, int index, int value) -
setInt16
public static void setInt16(byte[] buffer, int index, short value) 大端:向buffer中写入一个Int16 -
getInt16
public static short getInt16(byte[] buffer, int index) 大端:从buffer中读取一个Int16 -
setInt32
public static void setInt32(byte[] buffer, int index, int value) 大端:向buffer中写入一个Int32 -
getInt32
public static int getInt32(byte[] buffer, int index) 大端:从buffer中读取一个Int32 -
setUInt32
public static void setUInt32(byte[] buffer, int index, long value) 大端:向buffer中写入一个Int32 -
getUInt32
public static long getUInt32(byte[] buffer, int index) 大端:从buffer中读取一个Int32 -
setUInt48
public static void setUInt48(byte[] buffer, int index, long value) 大端:向buffer中写入一个UInt48 -
getUInt48
public static long getUInt48(byte[] buffer, int index) 大端:从buffer中读取一个UInt48 -
setInt64
public static void setInt64(byte[] buffer, int index, long value) 大端:向buffer中写入一个Int64 -
getInt64
public static long getInt64(byte[] buffer, int index) 大端:从buffer中读取一个Int64 -
setInt16LE
public static void setInt16LE(byte[] buffer, int index, short value) 小端:向buffer中写入一个Int16 -
getInt16LE
public static short getInt16LE(byte[] buffer, int index) 小端:从buffer中读取一个Int16 -
setInt32LE
public static void setInt32LE(byte[] buffer, int index, int value) 小端:向buffer中写入一个Int32 -
getInt32LE
public static int getInt32LE(byte[] buffer, int index) 小端:从buffer中读取一个Int32 -
setUInt32LE
public static void setUInt32LE(byte[] buffer, int index, long value) 小端:向buffer中写入一个Int32 -
getUInt32LE
public static long getUInt32LE(byte[] buffer, int index) 小端:从buffer中读取一个Int32 -
setUInt48LE
public static void setUInt48LE(byte[] buffer, int index, long value) 小端:向buffer中写入一个Int48 -
getUInt48LE
public static long getUInt48LE(byte[] buffer, int index) 小端:从buffer中读取一个Int48 -
setInt64LE
public static void setInt64LE(byte[] buffer, int index, long value) 小端:向buffer中写入一个Int64 -
getInt64LE
public static long getInt64LE(byte[] buffer, int index) 小端:从buffer中读取一个Int64
-