Class HexString

java.lang.Object
com.beanit.asn1bean.util.HexString

public class HexString extends Object
  • Method Details

    • fromByte

      public static String fromByte(byte b)
      Returns the byte as a hex string. If b is less than 16 the hex string returned contains a leading zero.
      Parameters:
      b - the byte to be converted
      Returns:
      the hex string.
    • fromByte

      public static String fromByte(int b)
    • fromInt

      public static String fromInt(int i)
      Returns the integer value as hex string filled with leading zeros.
      Parameters:
      i - the integer value to be converted
      Returns:
      the hex string
    • fromLong

      public static String fromLong(long l)
      Returns the long value as hex string filled with leading zeros.
      Parameters:
      l - the long value to be converted
      Returns:
      the hex string
    • fromBytes

      public static String fromBytes(byte[] bytes)
    • fromBytesFormatted

      public static String fromBytesFormatted(byte[] bytes)
    • fromBytes

      public static String fromBytes(byte[] bytes, int offset, int length)
    • fromBytes

      public static String fromBytes(ByteBuffer buffer)
    • fromBytesFormatted

      public static String fromBytesFormatted(byte[] bytes, int offset, int length)
    • toBytes

      public static byte[] toBytes(String hexString)
      Converts the given hex string to a byte array.
      Parameters:
      hexString - the hex string
      Returns:
      the bytes
      Throws:
      NumberFormatException - if the string is not a valid hex string
    • appendFromByte

      public static void appendFromByte(byte b, StringBuilder builder)
    • appendFromBytes

      public static void appendFromBytes(StringBuilder builder, byte[] bytes, int offset, int length)