Package org.qiunet.utils.data
Class ByteUtil
java.lang.Object
org.qiunet.utils.data.ByteUtil
- Author:
- qiunet 2020-11-17 12:48
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]int2Bytes(int value) int 转换为byte数组static byte[]long2Bytes(long value) long 转换为byte数组static intread32bit(byte[] code, int index) Reads a 32bit integer at the index.static byte[]readBytebuffer(ByteBuffer buffer) 读取ByteBuffer的内容.static byte[]readBytebuffer(ByteBuffer buffer, int index, int length) 读取ByteBuffer的内容.static intreadS16bit(byte[] code, int index) Reads a signed 16bit integer at the index.static intreadU16bit(byte[] code, int index) Reads an unsigned 16bit integer at the index.static byte[]short2Bytes(int value) short 转换为byte数组
-
Constructor Details
-
ByteUtil
public ByteUtil()
-
-
Method Details
-
readU16bit
public static int readU16bit(byte[] code, int index) Reads an unsigned 16bit integer at the index. -
readS16bit
public static int readS16bit(byte[] code, int index) Reads a signed 16bit integer at the index. -
read32bit
public static int read32bit(byte[] code, int index) Reads a 32bit integer at the index. -
short2Bytes
public static byte[] short2Bytes(int value) short 转换为byte数组- Parameters:
value-- Returns:
-
int2Bytes
public static byte[] int2Bytes(int value) int 转换为byte数组- Parameters:
value-- Returns:
-
long2Bytes
public static byte[] long2Bytes(long value) long 转换为byte数组- Parameters:
value-- Returns:
-
readBytebuffer
读取ByteBuffer的内容. 返回array- Parameters:
buffer-- Returns:
-
readBytebuffer
读取ByteBuffer的内容. 返回array- Parameters:
buffer-- Returns:
-