public class ByteUtils
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
static boolean |
IS_BIG_ENDING
内存数据是否为大端模式
|
构造器和说明 |
---|
ByteUtils() |
限定符和类型 | 方法和说明 |
---|---|
static byte[] |
getBytes(char data) |
static byte[] |
getBytes(double data) |
static byte[] |
getBytes(float data) |
static byte[] |
getBytes(int data) |
static byte[] |
getBytes(long data) |
static byte[] |
getBytes(short data) |
static byte[] |
getBytes(short[] shorts,
java.nio.ByteOrder order)
short 转 byte
|
static byte[] |
getBytes(short shortValue,
java.nio.ByteOrder order)
short 转 byte
|
static byte[] |
getBytes(java.lang.String data) |
static byte[] |
getBytes(java.lang.String data,
java.lang.String charsetName) |
static char |
getChar(byte[] bytes) |
static double |
getDouble(byte[] bytes) |
static float |
getFloat(byte[] bytes) |
static int |
getInt(byte[] bytes) |
static int |
getIntFill(byte[] bytes) |
static long |
getLong(byte[] bytes) |
static short |
getShort(byte[] bytes) |
static short |
getShort(byte firstByte,
byte secondByte,
java.nio.ByteOrder order)
byte 转 short
|
static short[] |
getShorts(byte[] bytes,
java.nio.ByteOrder order)
byte 转 short
|
static java.lang.String |
getString(byte[] bytes) |
static java.lang.String |
getString(byte[] bytes,
java.lang.String charsetName) |
static void |
intToByteArrayFull(byte[] dst,
int pos,
int interger) |
static void |
intToByteArrayTwoByte(byte[] dst,
int pos,
int interger) |
static boolean |
isBigendian()
判断内存数据是否为大端模式
|
static byte[] |
randomBytes(int length)
获取随机字节组
|
static short |
safeShort(int value)
转换成安全的short
|
static short[] |
safeShorts(int[] value)
转换成安全的short
|
public static byte[] getBytes(short data)
public static byte[] getBytes(char data)
public static byte[] getBytes(int data)
public static byte[] getBytes(long data)
public static byte[] getBytes(float data)
public static byte[] getBytes(double data)
public static byte[] getBytes(java.lang.String data, java.lang.String charsetName)
public static byte[] getBytes(java.lang.String data)
public static short getShort(byte[] bytes)
public static char getChar(byte[] bytes)
public static int getInt(byte[] bytes)
public static int getIntFill(byte[] bytes)
public static long getLong(byte[] bytes)
public static float getFloat(byte[] bytes)
public static double getDouble(byte[] bytes)
public static java.lang.String getString(byte[] bytes, java.lang.String charsetName)
public static java.lang.String getString(byte[] bytes)
public static byte[] randomBytes(int length)
length
- 字节组长度public static void intToByteArrayFull(byte[] dst, int pos, int interger)
dst
- 目标字节组pos
- 索引interger
- public static void intToByteArrayTwoByte(byte[] dst, int pos, int interger)
dst
- 目标字节组pos
- 索引interger
- public static short getShort(byte firstByte, byte secondByte, java.nio.ByteOrder order)
public static byte[] getBytes(short shortValue, java.nio.ByteOrder order)
public static short[] getShorts(byte[] bytes, java.nio.ByteOrder order)
public static byte[] getBytes(short[] shorts, java.nio.ByteOrder order)
public static short safeShort(int value)
public static short[] safeShorts(int[] value)
public static boolean isBigendian()