Java Doc for UUID.java in  » 6.0-JDK-Core » Collections-Jar-Zip-Logging-regex » java » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » Collections Jar Zip Logging regex » java.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.UUID

UUID
final public class UUID implements java.io.Serializable,Comparable<UUID>(Code)
A class that represents an immutable universally unique identifier (UUID). A UUID represents a 128-bit value.

There exist different variants of these global identifiers. The methods of this class are for manipulating the Leach-Salz variant, although the constructors allow the creation of any variant of UUID (described below).

The layout of a variant 2 (Leach-Salz) UUID is as follows: The most significant long consists of the following unsigned fields:

 0xFFFFFFFF00000000 time_low
 0x00000000FFFF0000 time_mid
 0x000000000000F000 version
 0x0000000000000FFF time_hi
 
The least significant long consists of the following unsigned fields:
 0xC000000000000000 variant
 0x3FFF000000000000 clock_seq
 0x0000FFFFFFFFFFFF node
 

The variant field contains a value which identifies the layout of the UUID . The bit layout described above is valid only for a UUID with a variant value of 2, which indicates the Leach-Salz variant.

The version field holds a value that describes the type of this UUID . There are four different basic types of UUIDs: time-based, DCE security, name-based, and randomly generated UUIDs. These types have a version value of 1, 2, 3 and 4, respectively.

For more information including algorithms used to create UUID s, see RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace, section 4.2 "Algorithms for Creating a Time-Based UUID".
since:
   1.5




Constructor Summary
public  UUID(long mostSigBits, long leastSigBits)
     Constructs a new UUID using the specified data.

Method Summary
public  intclockSequence()
     The clock sequence value associated with this UUID.

The 14 bit clock sequence value is constructed from the clock sequence field of this UUID.

public  intcompareTo(UUID val)
     Compares this UUID with the specified UUID.
public  booleanequals(Object obj)
     Compares this object to the specified object.
public static  UUIDfromString(String name)
     Creates a UUID from the string standard representation as described in the UUID.toString method.
public  longgetLeastSignificantBits()
     Returns the least significant 64 bits of this UUID's 128 bit value.
public  longgetMostSignificantBits()
     Returns the most significant 64 bits of this UUID's 128 bit value.
public  inthashCode()
     Returns a hash code for this UUID .
public static  UUIDnameUUIDFromBytes(byte[] name)
     Static factory to retrieve a type 3 (name based) UUID based on the specified byte array.
public  longnode()
     The node value associated with this UUID.

The 48 bit node value is constructed from the node field of this UUID.

public static  UUIDrandomUUID()
     Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
public  longtimestamp()
     The timestamp value associated with this UUID.

The 60 bit timestamp value is constructed from the time_low, time_mid, and time_hi fields of this UUID .

public  StringtoString()
     Returns a String object representing this UUID .
public  intvariant()
     The variant number associated with this UUID .
public  intversion()
     The version number associated with this UUID .


Constructor Detail
UUID
public UUID(long mostSigBits, long leastSigBits)(Code)
Constructs a new UUID using the specified data. mostSigBits is used for the most significant 64 bits of the UUID and leastSigBits becomes the least significant 64 bits of the UUID .
Parameters:
  mostSigBits - The most significant bits of the UUID
Parameters:
  leastSigBits - The least significant bits of the UUID




Method Detail
clockSequence
public int clockSequence()(Code)
The clock sequence value associated with this UUID.

The 14 bit clock sequence value is constructed from the clock sequence field of this UUID. The clock sequence field is used to guarantee temporal uniqueness in a time-based UUID.

The clockSequence value is only meaningful in a time-based UUID, which has version type 1. If this UUID is not a time-based UUID then this method throws UnsupportedOperationException. The clock sequence of this UUID
throws:
  UnsupportedOperationException - If this UUID is not a version 1 UUID




compareTo
public int compareTo(UUID val)(Code)
Compares this UUID with the specified UUID.

The first of two UUIDs is greater than the second if the most significant field in which the UUIDs differ is greater for the first UUID.
Parameters:
  val - UUID to which this UUID is to be compared -1, 0 or 1 as this UUID is less than, equal to, orgreater than val




equals
public boolean equals(Object obj)(Code)
Compares this object to the specified object. The result is true if and only if the argument is not null , is a UUID object, has the same variant, and contains the same value, bit for bit, as this UUID .
Parameters:
  obj - The object to be compared true if the objects are the same; false otherwise



fromString
public static UUID fromString(String name)(Code)
Creates a UUID from the string standard representation as described in the UUID.toString method.
Parameters:
  name - A string that specifies a UUID A UUID with the specified value
throws:
  IllegalArgumentException - If name does not conform to the string representation asdescribed in UUID.toString



getLeastSignificantBits
public long getLeastSignificantBits()(Code)
Returns the least significant 64 bits of this UUID's 128 bit value. The least significant 64 bits of this UUID's 128 bit value



getMostSignificantBits
public long getMostSignificantBits()(Code)
Returns the most significant 64 bits of this UUID's 128 bit value. The most significant 64 bits of this UUID's 128 bit value



hashCode
public int hashCode()(Code)
Returns a hash code for this UUID . A hash code value for this UUID



nameUUIDFromBytes
public static UUID nameUUIDFromBytes(byte[] name)(Code)
Static factory to retrieve a type 3 (name based) UUID based on the specified byte array.
Parameters:
  name - A byte array to be used to construct a UUID A UUID generated from the specified array



node
public long node()(Code)
The node value associated with this UUID.

The 48 bit node value is constructed from the node field of this UUID. This field is intended to hold the IEEE 802 address of the machine that generated this UUID to guarantee spatial uniqueness.

The node value is only meaningful in a time-based UUID, which has version type 1. If this UUID is not a time-based UUID then this method throws UnsupportedOperationException. The node value of this UUID
throws:
  UnsupportedOperationException - If this UUID is not a version 1 UUID




randomUUID
public static UUID randomUUID()(Code)
Static factory to retrieve a type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator. A randomly generated UUID



timestamp
public long timestamp()(Code)
The timestamp value associated with this UUID.

The 60 bit timestamp value is constructed from the time_low, time_mid, and time_hi fields of this UUID . The resulting timestamp is measured in 100-nanosecond units since midnight, October 15, 1582 UTC.

The timestamp value is only meaningful in a time-based UUID, which has version type 1. If this UUID is not a time-based UUID then this method throws UnsupportedOperationException.
throws:
  UnsupportedOperationException - If this UUID is not a version 1 UUID




toString
public String toString()(Code)
Returns a String object representing this UUID .

The UUID string representation is as described by this BNF:

 UUID                   =  "-"  "-"   "-"   "-"    time_low               = 4*  time_mid               = 2*  time_high_and_version  = 2*  variant_and_sequence   = 2*  node                   = 6*  hexOctet               =   hexDigit               =  "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"  | "a" | "b" | "c" | "d" | "e" | "f"  | "A" | "B" | "C" | "D" | "E" | "F"  
A string representation of this UUID



variant
public int variant()(Code)
The variant number associated with this UUID . The variant number describes the layout of the UUID . The variant number has the following meaning:

  • 0 Reserved for NCS backward compatibility
  • 2 The Leach-Salz variant (used by this class)
  • 6 Reserved, Microsoft Corporation backward compatibility
  • 7 Reserved for future definition
The variant number of this UUID



version
public int version()(Code)
The version number associated with this UUID . The version number describes how this UUID was generated. The version number has the following meaning:

  • 1 Time-based UUID
  • 2 DCE security UUID
  • 3 Name-based UUID
  • 4 Randomly generated UUID
The version number of this UUID



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.