Class HexCoDec


  • public class HexCoDec
    extends java.lang.Object
    A set of Hex encoding and decoding utility methods.
    • Constructor Summary

      Constructors 
      Constructor Description
      HexCoDec()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decode​(char[] hexChars)
      Decode an array of hex chars
      static byte[] decode​(char[] hexChars, int startIndex, int length)
      Decode an array of hex chars.
      static byte[] decode​(java.lang.String hexValue)
      Decode a hex string
      static char[] encode​(byte[] bites)
      Hex encode an array of bytes
      static char[] encode​(byte[] bites, int startIndex, int length)
      Hex encode an array of bytes
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HexCoDec

        public HexCoDec()
    • Method Detail

      • decode

        public static byte[] decode​(java.lang.String hexValue)
        Decode a hex string
        Parameters:
        hexValue - the string of hex characters
        Returns:
        the decode hex string as bytes.
      • decode

        public static byte[] decode​(char[] hexChars)
        Decode an array of hex chars
        Parameters:
        hexChars - an array of hex characters.
        Returns:
        the decode hex chars as bytes.
      • decode

        public static byte[] decode​(char[] hexChars,
                                    int startIndex,
                                    int length)
        Decode an array of hex chars.
        Parameters:
        hexChars - an array of hex characters.
        startIndex - the index of the first character to decode
        length - the number of characters to decode.
        Returns:
        the decode hex chars as bytes.
      • encode

        public static char[] encode​(byte[] bites)
        Hex encode an array of bytes
        Parameters:
        bites - the array of bytes to encode.
        Returns:
        the array of hex characters.
      • encode

        public static char[] encode​(byte[] bites,
                                    int startIndex,
                                    int length)
        Hex encode an array of bytes
        Parameters:
        bites - the array of bytes to encode.
        startIndex - the index of the first character to encode.
        length - the number of characters to encode.
        Returns:
        the array of hex characters.