Java Platform 1.2

java.rmi.server
Class UID

java.lang.Object
  |
  +--java.rmi.server.UID

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.
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.
Returns:
the hashcode
Overrides:
hashCode in class Object
Since:
JDK1.1
See Also:
Hashtable

equals

public boolean equals(Object obj)
Compares two UIDs for content equality.
Parameters:
obj - the Object to compare with
Returns:
true if these Objects are equal; false otherwise.
Overrides:
equals in class Object
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

Java Platform 1.2

Submit a bug or feature Version 1.2 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.