public class ByteUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
ESPTOUCH_ENCODING_CHARSET |
| 构造器和说明 |
|---|
ByteUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte |
combine2bytesToOne(byte high,
byte low)
Combine 2 bytes (high byte and low byte) to one whole byte
|
static char |
combine2bytesToU16(byte high,
byte low)
Combine 2 bytes (high byte and low byte) to
|
static String |
convertByte2HexString(byte b)
Convert byte to Hex String
|
static char |
convertByte2Uint8(byte b)
Convert char into uint8( we treat char as uint8 )
|
static char[] |
convertBytes2Uint8s(byte[] bytes)
Convert byte[] into char[]( we treat char[] as uint8[])
|
static String |
convertU8ToHexString(char u8)
Convert char(uint8) to Hex String
|
static byte |
convertUint8toByte(char uint8)
Convert uint8 into char( we treat char as uint8)
|
static byte[] |
genSpecBytes(byte len)
Generate the specific byte to be sent
|
static byte[] |
genSpecBytes(char len) |
static byte[] |
getBytesByString(String string) |
static void |
main(String[] args) |
static String |
parseBssid(byte[] bssidBytes)
parse "24,-2,52,-102,-93,-60" to "18,fe,34,9a,a3,c4"
parse the bssid from hex to String
|
static String |
parseBssid(byte[] bssidBytes,
int offset,
int count) |
static void |
putbytes2Uint8s(char[] destUint8s,
byte[] srcBytes,
int destOffset,
int srcOffset,
int count)
Put byte[] into char[]( we treat char[] as uint8[])
|
static void |
putString2bytes(byte[] destbytes,
String srcString,
int destOffset,
int srcOffset,
int count)
Put String to byte[]
|
static byte[] |
randomBytes(byte len)
Generate the random byte to be sent
|
static byte[] |
randomBytes(char len)
Generate the random byte to be sent
|
static byte[] |
splitUint8To2bytes(char uint8)
Split uint8 to 2 bytes of high byte and low byte. e.g. 20 = 0x14 should
be split to [0x01,0x04] 0x01 is high byte and 0x04 is low byte
|
public static void putString2bytes(byte[] destbytes,
String srcString,
int destOffset,
int srcOffset,
int count)
destbytes - the byte[] of destsrcString - the String of srcdestOffset - the offset of byte[]srcOffset - the offset of Stringcount - the count of dest, and the count of src as wellpublic static byte convertUint8toByte(char uint8)
uint8 - the unit8 to be convertedpublic static char convertByte2Uint8(byte b)
b - the byte to be convertedpublic static char[] convertBytes2Uint8s(byte[] bytes)
bytes - the byte[] to be convertedpublic static void putbytes2Uint8s(char[] destUint8s,
byte[] srcBytes,
int destOffset,
int srcOffset,
int count)
destUint8s - the char[](uint8[]) arraysrcBytes - the byte[]destOffset - the offset of char[](uint8[])srcOffset - the offset of byte[]count - the count of dest, and the count of src as wellpublic static String convertByte2HexString(byte b)
b - the byte to be convertedpublic static String convertU8ToHexString(char u8)
u8 - the char(uint8) to be convertedpublic static byte[] splitUint8To2bytes(char uint8)
uint8 - the char(uint8)public static byte combine2bytesToOne(byte high,
byte low)
high - the high bytelow - the low bytepublic static char combine2bytesToU16(byte high,
byte low)
high - the high bytelow - the low bytepublic static byte[] randomBytes(char len)
len - the len presented by u8public static byte[] genSpecBytes(char len)
public static byte[] randomBytes(byte len)
len - the len presented by bytepublic static byte[] genSpecBytes(byte len)
len - the len presented by bytepublic static String parseBssid(byte[] bssidBytes, int offset, int count)
public static String parseBssid(byte[] bssidBytes)
bssidBytes - the hex bytes bssid, e.g. {24,-2,52,-102,-93,-60}public static byte[] getBytesByString(String string)
string - the string to be usedESPTOUCH_ENCODING_CHARSETpublic static void main(String[] args)