Package org.fisco.bcos.sdk.utils
Class HexEncoder
java.lang.Object
org.fisco.bcos.sdk.utils.HexEncoder
public class HexEncoder
extends java.lang.Object
A streaming Hex encoder.
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
decodingTable
protected byte[]
encodingTable
-
Constructor Summary
Constructors Constructor Description HexEncoder()
-
Method Summary
Modifier and Type Method Description int
decode(byte[] data, int off, int length, java.io.OutputStream out)
decode the Hex encoded byte data writing it to the given output stream, whitespace characters will be ignored.int
decode(java.lang.String data, java.io.OutputStream out)
decode the Hex encoded String data writing it to the given output stream, whitespace characters will be ignored.int
encode(byte[] data, int off, int length, java.io.OutputStream out)
encode the input data producing a Hex output stream.protected void
initialiseDecodingTable()
-
Field Details
-
encodingTable
protected final byte[] encodingTable -
decodingTable
protected final byte[] decodingTable
-
-
Constructor Details
-
HexEncoder
public HexEncoder()
-
-
Method Details
-
initialiseDecodingTable
protected void initialiseDecodingTable() -
encode
public int encode(byte[] data, int off, int length, java.io.OutputStream out) throws java.io.IOExceptionencode the input data producing a Hex output stream.- Parameters:
data
- the input byte arrayoff
- the offset of the data to be convertedlength
- the length of the data to be convertedout
- the output stream- Returns:
- the number of bytes produced.
- Throws:
java.io.IOException
- the I/O exception
-
decode
public int decode(byte[] data, int off, int length, java.io.OutputStream out) throws java.io.IOExceptiondecode the Hex encoded byte data writing it to the given output stream, whitespace characters will be ignored.- Parameters:
data
- the input byte arrayoff
- the offset of the data to be convertedlength
- the length of the data to be convertedout
- the output stream- Returns:
- the number of bytes produced.
- Throws:
java.io.IOException
- the I/O exception
-
decode
public int decode(java.lang.String data, java.io.OutputStream out) throws java.io.IOExceptiondecode the Hex encoded String data writing it to the given output stream, whitespace characters will be ignored.- Parameters:
data
- the input byte arrayout
- the output stream- Returns:
- the number of bytes produced.
- Throws:
java.io.IOException
- the I/O exception
-