JXTA

net.jxta.impl.id.binaryID
Class PeerBinaryID

java.lang.Object
  extended by net.jxta.id.ID
      extended by net.jxta.peer.PeerID
          extended by net.jxta.impl.id.binaryID.PeerBinaryID
All Implemented Interfaces:
Serializable

public final class PeerBinaryID
extends PeerID

This class implements a PeerID. Each peer is assigned a unique peer id.UUID id are used to implement peer id.

See Also:
UUID, UUIDFactory, Serialized Form

Field Summary
 
Fields inherited from class net.jxta.id.ID
nullID, URIEncodingName, URNNamespace
 
Constructor Summary
  PeerBinaryID(BinaryID binaryID)
          Creates a new PeerID object.
  PeerBinaryID(PeerGroupID parent, byte[] data, boolean lengthIncluded)
          Constructor.
protected PeerBinaryID(String id)
          Creates a ID from a string.
 
Method Summary
 boolean equals(Object target)
          
protected  String getID()
          returns the coded ID without the binaryid tag.
 String getIDFormat()
          Returns a string identifier which indicates which ID format is used by this ID instance.
 ID getPeerGroupID()
          Returns PeerGroupID of the Peer Group to which this Peer ID belongs.
 Object getUniqueValue()
          Returns an object containing the unique value of the ID.
 int hashCode()
          
 
Methods inherited from class net.jxta.peer.PeerID
create, intern
 
Methods inherited from class net.jxta.id.ID
getURL, toString, toURI
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PeerBinaryID

protected PeerBinaryID(String id)
Creates a ID from a string. Note that the ID is not currently validated.

Parameters:
id - Value of ID.

PeerBinaryID

public PeerBinaryID(BinaryID binaryID)
Creates a new PeerID object.

Parameters:
binaryID - binary id to build the peerID from.

PeerBinaryID

public PeerBinaryID(PeerGroupID parent,
                    byte[] data,
                    boolean lengthIncluded)
Constructor. Creates a PeerID. A PeerGroupID and BinaryID is provided. If the binary ID is not a pipe ID, the construcion will throw a runtime exception.

Note that only the ID for the parent is obtained and not the parent and the grandparent.

Parameters:
parent - the group to which this will belong.
data - data byte array to be used as the id.
lengthIncluded - If true, the first byte in the data array is the length of the remaining bytes.
Method Detail

equals

public boolean equals(Object target)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

getIDFormat

public String getIDFormat()
Returns a string identifier which indicates which ID format is used by this ID instance.

Specified by:
getIDFormat in class ID
Returns:
a string identifier which indicates which ID format is used by this ID instance.

getUniqueValue

public Object getUniqueValue()
Returns an object containing the unique value of the ID. This object must provide implementations of toString(), equals() and hashCode() that are canonical and consistent from run-to-run given the same input values. Beyond this nothing should be assumed about the nature of this object. For some implementations the object returned may be this.

Specified by:
getUniqueValue in class ID
Returns:
Object which can provide canonical representations of the ID.

getPeerGroupID

public ID getPeerGroupID()
Returns PeerGroupID of the Peer Group to which this Peer ID belongs.

Specified by:
getPeerGroupID in class PeerID
Returns:
PeerGroupID of the Peer Group to which this Peer ID belongs.

getID

protected String getID()
returns the coded ID without the binaryid tag.

Returns:
The raw ID.

JXSE