Class UuidUtils

java.lang.Object
net.glowstone.util.UuidUtils

public final class UuidUtils extends Object
Utility methods for dealing with UUIDs.
  • Method Details

    • fromString

      public static UUID fromString(String str)
      Parses a UUID from a hexadecimal string with hyphens.
      Parameters:
      str - a hexadecimal string
      Returns:
      str as a UUID
    • fromFlatString

      public static UUID fromFlatString(String str)
      Parses a UUID from a hexadecimal string without hyphens.
      Parameters:
      str - a 32-digit hexadecimal string
      Returns:
      str as a UUID
    • toString

      public static String toString(UUID uuid)
      Converts a UUID to a hexadecimal string with hyphens.

      This method uses the FastUUID library for faster serialization in Java 8.

      Parameters:
      uuid - a UUID
      Returns:
      uuid as a hexadecimal string
      See Also:
      • FastUUID.toString(UUID)
    • toFlatString

      public static String toFlatString(UUID uuid)
      Converts a UUID to a hexadecimal string without hyphens.

      This method uses the FastUUID library for faster serialization in Java 8.

      Parameters:
      uuid - a UUID
      Returns:
      uuid as a hexadecimal string without hyphens
      See Also:
      • FastUUID.toString(UUID)
    • toIntArray

      public static int[] toIntArray(UUID uuid)
      Convert a UUID to its Int-Array representation.
      Parameters:
      uuid - a UUID
      Returns:
      the Int-Array representation of the UUID
    • fromIntArray

      public static UUID fromIntArray(int[] arr)
      Parses a UUID from an Int-Array representation.
      Parameters:
      arr - the int array containint the representation
      Returns:
      a UUID