Class LongStringUtils

java.lang.Object
datadog.trace.api.internal.util.LongStringUtils

public class LongStringUtils extends Object
Utility class with common long decimal and hexadecimal parsing, and String creation methods.
  • Method Details

    • parseUnsignedLongHex

      public static long parseUnsignedLongHex(CharSequence s) throws NumberFormatException
      Parse the hex representation of the unsigned 64 bit long from the String.
      Parameters:
      s - String in hexadecimal of unsigned 64-bits long.
      Returns:
      long
      Throws:
      NumberFormatException
    • parseUnsignedLongHex

      public static long parseUnsignedLongHex(CharSequence s, int start, int len, boolean lowerCaseOnly) throws NumberFormatException
      Parse the hex representation of the unsigned 64 bit long from the String.
      Parameters:
      s - String in hex of unsigned 64 bits
      start - the start index of the hex value
      len - the len of the hex value
      lowerCaseOnly - if the allowed hex characters are lower case only
      Returns:
      long
      Throws:
      NumberFormatException
    • parseUnsignedLong

      public static long parseUnsignedLong(String s) throws NumberFormatException
      Throws:
      NumberFormatException
    • numberFormatOutOfLongRange

      public static NumberFormatException numberFormatOutOfLongRange(CharSequence s)
      Creates a NumberFormatException with a consistent error message.
      Parameters:
      s - the String that exceeds the range of a Long
      Returns:
      NumberFormatException
    • toHexStringPadded

      public static String toHexStringPadded(long id, int size)
    • toHexStringPadded

      public static String toHexStringPadded(long highOrderBits, long lowOrderBits, int size)