Class HexUtils

java.lang.Object
io.servicetalk.opentracing.internal.HexUtils

public final class HexUtils extends Object
Utilities for hex strings.
  • Method Details

    • validateHexBytes

      public static <T extends CharSequence> T validateHexBytes(T str)
      Checks that the provided CharSequence is a valid hex CharSequence, throwing an IllegalArgumentException if it is not.
      Type Parameters:
      T - The type of CharSequence to validate.
      Parameters:
      str - the CharSequence to check.
      Returns:
      the provided CharSequence unchanged.
    • longOfHexBytes

      public static long longOfHexBytes(String str, int offset)
      Retrieves the long value represented by the provided hex String. Throws StringIndexOutOfBoundsException if offset is invalid.
      Parameters:
      str - an hex String.
      offset - The index to start within str to start the conversion.
      Returns:
      the long value.
    • hexBytesOfLong

      public static String hexBytesOfLong(long v)
      Builds an hex String that represents the provided long value.
      Parameters:
      v - the long value.
      Returns:
      an hex String.