Class UUIDGen


  • public class UUIDGen
    extends java.lang.Object
    The goods are here: www.ietf.org/rfc/rfc4122.txt.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int UUID_LEN  
    • Constructor Summary

      Constructors 
      Constructor Description
      UUIDGen()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decompose​(java.util.UUID uuid)
      decomposes a uuid into raw bytes.
      static long getAdjustedTimestamp​(java.util.UUID uuid)
      Returns a milliseconds-since-epoch value for a type-1 UUID.
      static java.util.UUID getUUID​(java.nio.ByteBuffer raw)
      creates a type 1 uuid from raw bytes.
      static java.nio.ByteBuffer toByteBuffer​(java.util.UUID uuid)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UUIDGen

        public UUIDGen()
    • Method Detail

      • getUUID

        public static java.util.UUID getUUID​(java.nio.ByteBuffer raw)
        creates a type 1 uuid from raw bytes.
      • toByteBuffer

        public static java.nio.ByteBuffer toByteBuffer​(java.util.UUID uuid)
      • decompose

        public static byte[] decompose​(java.util.UUID uuid)
        decomposes a uuid into raw bytes.
      • getAdjustedTimestamp

        public static long getAdjustedTimestamp​(java.util.UUID uuid)
        Returns a milliseconds-since-epoch value for a type-1 UUID.
        Parameters:
        uuid - a type-1 (time-based) UUID
        Returns:
        the number of milliseconds since the unix epoch
        Throws:
        java.lang.IllegalArgumentException - if the UUID is not version 1