public class HexCodec extends Object implements BinaryCodec
Charsets.UTF_8
This class is thread-safe.
| 构造器和说明 |
|---|
HexCodec()
Creates a new codec with the default charset name
Charsets.UTF_8 |
HexCodec(Charset charset)
Creates a new codec with the given Charset.
|
HexCodec(String charsetName)
Creates a new codec with the given charset name.
|
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
decode(byte[] array)
Converts an array of character bytes representing hexadecimal values into an array of bytes of those same values.
|
byte[] |
encode(byte[] array)
Converts an array of bytes into an array of bytes for the characters representing the hexadecimal values of each
byte in order.
|
Charset |
getCharset()
Gets the charset.
|
String |
getCharsetName()
Gets the charset name.
|
String |
toString()
Returns a string representation of the object, which includes the charset name.
|
public HexCodec()
Charsets.UTF_8public HexCodec(Charset charset)
charset - the charset.public HexCodec(String charsetName)
charsetName - the charset name.UnsupportedCharsetException - If the named charset is unavailablepublic byte[] decode(byte[] array)
throws CodecException
decode 在接口中 BinaryCodecdecode 在接口中 BinaryDecoderdecode 在接口中 Decoder<byte[],byte[]>decode 在接口中 ICodec<byte[]>array - An array of character bytes containing hexadecimal digitsCodecException - Thrown if an odd number of characters is supplied to this functionHex#decodeHex(char[])}public byte[] encode(byte[] array)
The conversion from hexadecimal characters to the returned bytes is performed with the charset named by
getCharset().
encode 在接口中 BinaryCodecencode 在接口中 BinaryEncoderencode 在接口中 Encoder<byte[],byte[]>encode 在接口中 ICodec<byte[]>array - a byte[] to convert to Hex charactersHex#encodeHex(byte[])}public Charset getCharset()
public String getCharsetName()
Copyright © 2021. All rights reserved.