Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.jini.core.lookup
Class ServiceID

    java.lang.Object
      net.jini.core.lookup.ServiceID

All Implemented Interfaces:
  Serializable

public final class ServiceID
extends Object
implements Serializable

A universally unique identifier (UUID) for registered services. A service ID is a 128-bit value. Service IDs are normally intended to either be built into services at manufacture or deployment time, or generated dynamically by lookup services at registration time.

The most significant long can be decomposed into the following unsigned fields:

     0xFFFFFFFF00000000 time_low
     0x00000000FFFF0000 time_mid
     0x000000000000F000 version
     0x0000000000000FFF time_hi

The least significant long can be decomposed into the following unsigned fields:

     0xC000000000000000 variant
     0x3FFF000000000000 clock_seq
     0x0000FFFFFFFFFFFF node

The variant field must be 0x2. The version field must be either 0x1 or 0x4. If the version field is 0x4, then the remaining fields are set to values produced by a cryptographically secure random sequence. If the version field is 0x1, then the node field is set to an IEEE 802 address, the clock_seq field is set to a 14-bit random number, and the time_low, time_mid, and time_hi fields are set to the least, middle and most significant bits (respectively) of a 60-bit timestamp measured in 100-nanosecond units since midnight, October 15, 1582 UTC.

Since:
  1.0
See Also:
  Serialized Form

Constructor Summary
`ServiceID(DataInput in)` Reads in 16 bytes in standard network byte order.
`ServiceID(long mostSig, long leastSig)` Simple constructor.

Method Summary
`boolean` | `equals(Object obj)` Service IDs are equal if they represent the same 128-bit value.
`long` | `getLeastSignificantBits()` Returns the least significant 64 bits of the service ID.
`long` | `getMostSignificantBits()` Returns the most significant 64 bits of the service ID.
`int` | `hashCode()`
`String` | `toString()` Returns a 36-character string of five fields separated by hyphens, with each field represented in lowercase hexadecimal with the same number of digits as in the field.
`void` | `writeBytes(DataOutput out)` Writes out 16 bytes in standard network byte order.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ServiceID

    public ServiceID(long mostSig,
                     long leastSig)

  Simple constructor.

Parameters:
  `mostSig` - the most significant 64 bits
  `leastSig` - the lease significant 64 bits

### ServiceID

    public ServiceID(DataInput in)
              throws IOException

  Reads in 16 bytes in standard network byte order.

Parameters:
  `in` - the input stream to read 16 bytes from
Throws:
  `IOException` - if there is a problem reading the most and least significant bits

Method Detail

### getMostSignificantBits

    public long getMostSignificantBits()

  Returns the most significant 64 bits of the service ID.

  Returns:
    a `long` representing the most significant bits value

### getLeastSignificantBits

    public long getLeastSignificantBits()

  Returns the least significant 64 bits of the service ID.

  Returns:
    a `long` representing the least significant bits value

### writeBytes

    public void writeBytes(DataOutput out)
                    throws IOException

  Writes out 16 bytes in standard network byte order.

  Parameters:
    `out` - the output stream to which 16 bytes should be written
  Throws:
    `IOException` - if there is a problem writing the bytes

### hashCode

    public int hashCode()

### equals

    public boolean equals(Object obj)

  Service IDs are equal if they represent the same 128-bit value.

### toString

    public String toString()

  Returns a 36-character string of five fields separated by hyphens, with each field represented in lowercase hexadecimal with the same number of digits as in the field. The order of fields is: `time_low`, `time_mid`, `version` and `time_hi` treated as a single field, `variant` and `clock_seq` treated as a single field, and `node`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Sun Microsystems, Inc. All rights reserved