Class Guid

  • @Scriptable
    public final class Guid
    extends Object
    This class represents global universal IDs.

    Instances of this class are immutable.

    This class uses the SHAPRNG for secure random numbers and the SHA-1 algorithm for hashing to 20 bytes.

    • Field Detail

      • NULL_GUID

        public static final Guid NULL_GUID
        The GUID that consists solely of zero bytes.

        public static final int STRING_LENGTH
        The length of a GUID represented as a string.
        See Also:
        Constant Field Values
    • Method Detail

      • seed

        public static void seed()
        Initialize the random number generator.

        This method should be called at most once per Java VM instance.

      • createInstance

        public static Guid createInstance()
        Creates an instance of GUID using the SHAPRNG algorithm and the current system time.
        An initialized instance of Guid.
      • createInstance

        public static Guid createInstance​(byte[]... p_randomBytes)
        Creates an instance of GUID using given random bytes.
        p_randomBytes - Random bytes that are used to create the GUID.
        An initialized instance of Guid.
      • getBytes

        public byte[] getBytes()
        Get the GUIDs 20 bytes.
        A copy of this GUIDs bytes.
      • isStringRepresentation

        public static boolean isStringRepresentation​(String p_str)
        Tests if the given string is a GUID representation.
        p_str - The string to test (may be null).
        true if the string is representing a GUID, false otherwise.
      • toString

        public String toString()
        Convert the GUID to a string.
        toString in class Object
        The string representation of the GUID.
      • hashCode

        public int hashCode()
        hashCode in class Object