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()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • initialiseDecodingTable

      protected void initialiseDecodingTable()
    • encode

      public int encode​(byte[] data, int off, int length, java.io.OutputStream out) throws java.io.IOException
      encode the input data producing a Hex output stream.
      Parameters:
      data - the input byte array
      off - the offset of the data to be converted
      length - the length of the data to be converted
      out - 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.IOException
      decode the Hex encoded byte data writing it to the given output stream, whitespace characters will be ignored.
      Parameters:
      data - the input byte array
      off - the offset of the data to be converted
      length - the length of the data to be converted
      out - 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.IOException
      decode the Hex encoded String data writing it to the given output stream, whitespace characters will be ignored.
      Parameters:
      data - the input byte array
      out - the output stream
      Returns:
      the number of bytes produced.
      Throws:
      java.io.IOException - the I/O exception