JXTA

net.jxta.impl.id.UUID
Class IDBytes

java.lang.Object
  extended by net.jxta.impl.id.UUID.IDBytes
All Implemented Interfaces:
Serializable

public final class IDBytes
extends Object
implements Serializable

Maintains the internal representation of a 'uuid' JXTA ID.

See Also:
IDFactory, IDFormat, JXTA Protocols Specification : UUID ID Format, Serialized Form

Field Summary
 byte[] bytes
          The bytes.
protected  int cachedHash
          The cached hash value for this object
 
Constructor Summary
IDBytes()
          Constructs a new byte representation.
IDBytes(byte type)
          Constructs a new byte representation.
 
Method Summary
 long bytesIntoLong(int offset)
          Return the long value of a portion of the byte array.
 boolean equals(Object target)
          
 Object getUniqueValue()
          Return an object containing the unique value of the ID.
 int hashCode()
          
 void longIntoBytes(int offset, long value)
          Insert a long value into the byte array.
 String toString()
          Returns a string representation of the ID bytes.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

bytes

public final byte[] bytes
The bytes.


cachedHash

protected transient int cachedHash
The cached hash value for this object

Constructor Detail

IDBytes

public IDBytes()
Constructs a new byte representation. This constructor initializes only the flag fields of the ID.


IDBytes

public IDBytes(byte type)
Constructs a new byte representation. This constructor initializes only the flag fields of the ID.

Method Detail

equals

public boolean equals(Object target)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()
Returns a string representation of the ID bytes. The bytes are encoded in hex ASCII format with two characters per byte. The pad bytes between the primary id portion and the flags field are omitted.

Overrides:
toString in class Object
Returns:
String containing the unique value of this ID.

getUniqueValue

public Object getUniqueValue()
Return an object containing the unique value of the ID. This object must provide implementations of toString() 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 the same as provided.

Returns:
Object which can provide canonical representations of the ID.

longIntoBytes

public void longIntoBytes(int offset,
                          long value)
Insert a long value into the byte array. The long is stored in big-endian order into the byte array beginning at the specified index.

Parameters:
offset - location within the byte array to insert.
value - value to be inserted.

bytesIntoLong

public long bytesIntoLong(int offset)
Return the long value of a portion of the byte array. The long is retrieved in big-endian order from the byte array at the specified offset.

Parameters:
offset - location within the byte array to extract.
Returns:
long value extracted from the byte array.

JXSE