J2ME RMI Optional Package

java.rmi.server
Class ObjID

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

public final class ObjID
extends java.lang.Object
implements java.io.Serializable

An ObjID is used to identify remote objects uniquely in a VM over time. Each identifier contains an object number and an address space identifier that is unique with respect to a specific host. An object identifier is assigned to a remote object when it is exported. If the property java.rmi.server.randomIDs is true, then the object number component (64 bits) of an ObjID created with the no argument constructor will contain a cryptographically strong random number.

Since:
JDK1.1
See Also:
Serialized Form

Field Summary
static int ACTIVATOR_ID
          well-known id for the activator.
static int DGC_ID
          well-known id for the distributed garbage collector.
static int REGISTRY_ID
          well-known id for the registry.
 
Constructor Summary
ObjID()
          Generates a unique object identifier.
ObjID(int num)
          Generates a "well-known" object ID.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Two object identifiers are considered equal if they have the same contents.
 int hashCode()
          Returns the hash code for the ObjID (the object number).
static ObjID read(java.io.ObjectInput in)
          Constructs an object id whose contents is read from the specified input stream.
 java.lang.String toString()
          Returns a string containing the object id representation.
 void write(java.io.ObjectOutput out)
          Marshals object id to output stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

REGISTRY_ID

public static final int REGISTRY_ID
well-known id for the registry.

ACTIVATOR_ID

public static final int ACTIVATOR_ID
well-known id for the activator.

DGC_ID

public static final int DGC_ID
well-known id for the distributed garbage collector.
Constructor Detail

ObjID

public ObjID()
Generates a unique object identifier. If the property java.rmi.server.randomIDs is true, then the object number component (64 bits) of an ObjID created with the no argument constructor will contain a cryptographically strong random number.
Since:
JDK1.1

ObjID

public ObjID(int num)
Generates a "well-known" object ID. An object ID generated via this constructor will not clash with any object IDs generated via the default constructor.
Parameters:
num - a unique well-known object number
Since:
JDK1.1
Method Detail

write

public void write(java.io.ObjectOutput out)
           throws java.io.IOException
Marshals object id to output stream.
Parameters:
out - output stream to write object ID to
Throws:
IOException - if an I/O error occurred
Since:
JDK1.1

read

public static ObjID read(java.io.ObjectInput in)
                  throws java.io.IOException
Constructs an object id whose contents is read from the specified input stream.
Parameters:
in - input stream to read object ID from
Returns:
object ID instance read from stream
Throws:
IOException - if an I/O error occurred
Since:
JDK1.1

hashCode

public int hashCode()
Returns the hash code for the ObjID (the object number).
Overrides:
hashCode in class java.lang.Object
Since:
JDK1.1

equals

public boolean equals(java.lang.Object obj)
Two object identifiers are considered equal if they have the same contents.
Overrides:
equals in class java.lang.Object
Since:
JDK1.1

toString

public java.lang.String toString()
Returns a string containing the object id representation. The address space identifier is included in the string representation only if the object id is from a non-local address space.
Overrides:
toString in class java.lang.Object
Since:
JDK1.1

J2ME RMI Optional Package

Copyright 1994-2002 Sun Microsystems, Inc. All Rights Reserved.