Module de.carne
Package de.carne.text

Class HexBytes


  • public final class HexBytes
    extends java.lang.Object
    Utility class providing hex sequence conversion functions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String toStringL​(byte[] bs)
      Converts a byte array to a lower case hex sequence.
      static java.lang.String toStringL​(byte[] bs, int off, int len)
      Converts a byte array to a lower case hex sequence.
      static java.lang.String toStringU​(byte[] bs)
      Converts a byte array to an upper case hex sequence.
      static java.lang.String toStringU​(byte[] bs, int off, int len)
      Converts a byte array to an upper case hex sequence.
      static int valueOf​(char c)
      Converts a hex character to a byte value.
      static byte[] valueOf​(java.lang.String s)
      Converts a hex sequence to a byte array.
      • Methods inherited from class java.lang.Object

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

      • toStringL

        public static java.lang.String toStringL​(byte[] bs)
        Converts a byte array to a lower case hex sequence.
        Parameters:
        bs - the byte array to convert.
        Returns:
        the hex sequence representing the byte array.
      • toStringL

        public static java.lang.String toStringL​(byte[] bs,
                                                 int off,
                                                 int len)
        Converts a byte array to a lower case hex sequence.
        Parameters:
        bs - the byte array to convert.
        off - the first byte to convert.
        len - the number of bytes to convert.
        Returns:
        the hex sequence representing the byte array.
      • toStringU

        public static java.lang.String toStringU​(byte[] bs)
        Converts a byte array to an upper case hex sequence.
        Parameters:
        bs - the byte array to convert.
        Returns:
        the hex sequence representing the byte array.
      • toStringU

        public static java.lang.String toStringU​(byte[] bs,
                                                 int off,
                                                 int len)
        Converts a byte array to an upper case hex sequence.
        Parameters:
        bs - the byte array to convert.
        off - the first byte to convert.
        len - the number of bytes to convert.
        Returns:
        the hex sequence representing the byte array.
      • valueOf

        public static byte[] valueOf​(java.lang.String s)
        Converts a hex sequence to a byte array.
        Parameters:
        s - the hex sequence to convert.
        Returns:
        the byte array represented by the submitted hex sequence.
        Throws:
        java.lang.NumberFormatException - if the hex sequence is invalid.
      • valueOf

        public static int valueOf​(char c)
        Converts a hex character to a byte value.
        Parameters:
        c - the hex character to convert.
        Returns:
        the byte value represented by the submitted hex character.
        Throws:
        java.lang.NumberFormatException - if the hex character is invalid.