Class UUID58

java.lang.Object
de.s42.base.uuid.UUID58

public final class UUID58 extends Object
UUID58 provides uuid base58 string encoding and decoding for UUIDs to shorten, improve readability and cinvalid input: '&p' support in string form. uuid58 strings look like: hxAGoWGvFPR35qxCG5fYuX, ouyeFFWJLjnNeJfjs9DcvY, cyAp8zexLqUQRGFxRVcBCF, ...
Author:
Benjamin Schiller
  • Field Details

    • SYMBOLS

      public static final String SYMBOLS
      This is the symbols used for the encodet string to improve readability avoiding similar chars like 0 and O or 1 and I
      See Also:
    • SYMBOLS_CHARS

      public static final char[] SYMBOLS_CHARS
    • UUID58_PATTERN

      public static final Pattern UUID58_PATTERN
      This pattern allows you to validate a uuid58 string pattern
    • RADIX

      public static final BigInteger RADIX
      The radix 58 as BigInteger
  • Constructor Details

    • UUID58

      private UUID58()
  • Method Details

    • isUUID58Like

      public static boolean isUUID58Like(String string)
      Checks if the given string could be a valid uuid58 string.
      Parameters:
      string -
      Returns:
    • fromString

      Converts a uuid base58 string into a UUID. ATTENTION: A uuid base58 string is often 22 signs, BUT can be as short as 18 chars if the uuid (i.e. v4) has many leading 0-
      Parameters:
      uuid58 - A valid uuid base58 string
      Returns:
      Restored UUID from uuid58 string
      Throws:
      IllegalArgumentException - If the string is too long
      IndexOutOfBoundsException - If a character is contained which is not part of the Symbols
      NullPointerException - If the parameter uuid58 is null
    • toString

      public static String toString(UUID uuid) throws NullPointerException
      Converts a UUID into a uuid base58 string.
      Parameters:
      uuid - The UUID to be converted
      Returns:
      The uuid base58 string
      Throws:
      NullPointerException - If the parameter uuid58 is null