JavaTM 2 Platform
Std. Ed. v1.3.1

java.rmi.server
Class UID

java.lang.Object
  |
  +--java.rmi.server.UID
All Implemented Interfaces:
Serializable

public final class UID
extends Object
implements Serializable

Abstraction for creating identifiers that are unique with respect to the the host on which it is generated.

Since:
JDK1.1
See Also:
Serialized Form

Constructor Summary
UID()
          Creates a pure identifier that is unique with respect to the host on which it is generated.
UID(short num)
          Creates a "well-known" ID.
 
Method Summary
 boolean equals(Object obj)
          Compares two UIDs for content equality.
 int hashCode()
          Returns a hashcode for the UID.
static UID read(DataInput in)
          Reads the UID from the input stream.
 String toString()
          Returns the string representation of the UID.
 void write(DataOutput out)
          Write the UID to output stream, out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UID

public UID()
Creates a pure identifier that is unique with respect to the host on which it is generated. This UID is unique under the following conditions: a) the machine takes more than one second to reboot, and b) the machine's clock is never set backward. In order to construct a UID that is globally unique, simply pair a UID with an InetAddress.
Since:
JDK1.1

UID

public UID(short num)
Creates a "well-known" ID. There are 2^16 -1 such possible well-known ids. An id generated via this constructor will not clash with any id generated via the default UID constructor which will generates a genuinely unique identifier with respect to this host.
Parameters:
num - well known ID number
Since:
JDK1.1
Method Detail

hashCode

public int hashCode()
Returns a hashcode for the UID. Two UIDs will have the same hashcode if they are equal with respect to their content.
Overrides:
hashCode in class Object
Returns:
the hashcode
Since:
JDK1.1
See Also:
Hashtable

equals

public boolean equals(Object obj)
Compares two UIDs for content equality.
Overrides:
equals in class Object
Parameters:
obj - the Object to compare with
Returns:
true if these Objects are equal; false otherwise.
Since:
JDK1.1
See Also:
Hashtable

toString

public String toString()
Returns the string representation of the UID.
Overrides:
toString in class Object
Since:
JDK1.1

write

public void write(DataOutput out)
           throws IOException
Write the UID to output stream, out.
Parameters:
out - the output stream to which the UID is written
Throws:
IOException - if writing the UID to the stream fails.
Since:
JDK1.1

read

public static UID read(DataInput in)
                throws IOException
Reads the UID from the input stream.
Parameters:
in - the input stream
Returns:
the UID
Throws:
IOException - if uid could not be read (due to stream failure or malformed UID)
Since:
JDK1.1

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.