站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Class UID - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

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.
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
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.