public abstract class ByteUtil extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ByteUtil.AssitRead
读帮助类
|
static class |
ByteUtil.AssitWrite
写帮助类
|
| 构造器和说明 |
|---|
ByteUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
and(byte[] data1,
byte[] data2) |
static int |
byteshas0(byte[] bytes)
bytes含有0的个数
|
static int |
byteshas1(byte[] bytes)
bytes含有1的个数
|
static byte[] |
concat(byte[] data1,
byte[] data2) |
static boolean |
equals(byte[] data1,
byte[] data2) |
static byte[] |
or(byte[] data1,
byte[] data2) |
static int |
readInt(byte[] bytes,
boolean littleEndian)
虽然int占4个字节,但有一个符号位,如果要得到无符号的int,bytes最多只能为3,如果大于3字节,请用readLong
|
static int |
readIntB(byte[] bytes) |
static int |
readIntL(byte[] bytes) |
static int |
readIntL(byte[] bytes,
int offset,
int length) |
static int |
readIntSigned(byte[] bytes)
读带符号的整形
|
static long |
readLong(byte[] bytes,
boolean littleEndian)
读无符号的long
|
static long |
readLongB(byte[] bytes) |
static long |
readLongL(byte[] bytes) |
static long |
readLongL(byte[] bytes,
int offset,
int length) |
long |
readLongSigned(byte[] bytes)
读带符号的Long
|
static String |
readString(byte[] bytes) |
static String |
readString(byte[] bytes,
int offset,
int length) |
static byte[][] |
splitBytes(byte[] data,
int maxLength)
把data分隔成每行最多maxLength列的多行数组
|
static byte[] |
toBigEndian(byte[] value)
小字节序转为大字节序
|
static byte[] |
toByteArray(byte num) |
static byte[] |
toByteArray(int num) |
static byte[] |
toByteArray(long num) |
static byte[] |
toByteArray(short num) |
static int |
toUnsigned(byte b)
得到无符号int
|
static long |
toUnsigned(int i)
得到无符号long
|
static int |
toUnsigned(short s)
得到无符号int
|
static byte[] |
trunc00(byte[] bytes)
把前后的00二进制去掉进,要求中间不出现00
|
static byte[] |
xor(byte[] data1,
byte[] data2) |
public static byte[] toBigEndian(byte[] value)
value - public static int toUnsigned(byte b)
b - public static int toUnsigned(short s)
s - public static long toUnsigned(int i)
i - public static long readLong(byte[] bytes,
boolean littleEndian)
bytes - littleEndian - public static long readLongL(byte[] bytes)
public static long readLongL(byte[] bytes,
int offset,
int length)
public static long readLongB(byte[] bytes)
public long readLongSigned(byte[] bytes)
bytes - public static int byteshas1(byte[] bytes)
bytes - public static int byteshas0(byte[] bytes)
bytes - public static int readInt(byte[] bytes,
boolean littleEndian)
bytes - 要转的字节littleEndian - 是否小字节序public static int readIntL(byte[] bytes)
public static int readIntL(byte[] bytes,
int offset,
int length)
public static int readIntB(byte[] bytes)
public static int readIntSigned(byte[] bytes)
bytes - public static String readString(byte[] bytes)
public static byte[] trunc00(byte[] bytes)
bytes - public static String readString(byte[] bytes, int offset, int length)
public static byte[] toByteArray(byte num)
public static byte[] toByteArray(short num)
public static byte[] toByteArray(int num)
public static byte[] toByteArray(long num)
public static byte[][] splitBytes(byte[] data,
int maxLength)
data - 要分隔的数据源maxLength - 每行最多列public static byte[] or(byte[] data1,
byte[] data2)
public static byte[] and(byte[] data1,
byte[] data2)
public static byte[] xor(byte[] data1,
byte[] data2)
public static boolean equals(byte[] data1,
byte[] data2)
public static byte[] concat(byte[] data1,
byte[] data2)
Copyright © 2016. All rights reserved.