Class StringByteHelper


  • public final class StringByteHelper
    extends java.lang.Object
    Helper methods for working with hex encoded string and bytes
    Since:
    0.0.1
    See Also:
    CLTypeData
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String convertBytesToHex​(byte[] bytes)
      Helper method which returns byte arrays as hex strings
      static byte[] hexStringToByteArray​(java.lang.String hexString)
      Helper method which converts hex-encoded String to byte array
      static void reverse​(byte[] bytes)
      Reverses a byte array, used to go from little to big endianness
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • reverse

        public static void reverse​(byte[] bytes)
        Reverses a byte array, used to go from little to big endianness
        Parameters:
        bytes - array of bytes to reverse
      • hexStringToByteArray

        public static byte[] hexStringToByteArray​(java.lang.String hexString)
                                           throws InvalidByteStringException
        Helper method which converts hex-encoded String to byte array
        Parameters:
        hexString - the hex-encoded String to decode
        Returns:
        decoded array of bytes
        Throws:
        InvalidByteStringException
      • convertBytesToHex

        public static java.lang.String convertBytesToHex​(byte[] bytes)
        Helper method which returns byte arrays as hex strings
        Parameters:
        bytes - the byte array to encode
        Returns:
        hex-encoded value String