public class Base16Codec extends Object implements Encoder<byte[],char[]>, Decoder<CharSequence,byte[]>
Modifier and Type | Field and Description |
---|---|
static Base16Codec |
CODEC_LOWER |
static Base16Codec |
CODEC_UPPER |
Constructor and Description |
---|
Base16Codec(boolean lowerCase)
构造
|
Modifier and Type | Method and Description |
---|---|
void |
appendHex(StringBuilder builder,
byte b)
将byte值转为16进制并添加到
StringBuilder 中 |
byte[] |
decode(CharSequence encoded)
执行解码
|
char[] |
encode(byte[] data)
执行编码
|
String |
toUnicodeHex(char ch)
将指定char值转换为Unicode字符串形式,常用于特殊字符(例如汉字)转Unicode形式
转换的字符串如果u后不足4位,则前面用0填充,例如: '你' =》'你' |
public static final Base16Codec CODEC_LOWER
public static final Base16Codec CODEC_UPPER
public Base16Codec(boolean lowerCase)
lowerCase
- 是否小写public char[] encode(byte[] data)
Encoder
public byte[] decode(CharSequence encoded)
Decoder
decode
in interface Decoder<CharSequence,byte[]>
encoded
- 被解码的数据public String toUnicodeHex(char ch)
'你' =》'你'
ch
- char值public void appendHex(StringBuilder builder, byte b)
StringBuilder
中builder
- StringBuilder
b
- byteCopyright © 2024. All rights reserved.