Project JXTA

net.jxta.impl.id.UUID
Class CodatID

java.lang.Object
  extended by net.jxta.id.ID
      extended by net.jxta.codat.CodatID
          extended by net.jxta.impl.id.UUID.CodatID
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CodatID

public class CodatID
extends CodatID

An implementation of the CodatID ID Type.

See Also:
Serialized Form

Field Summary
protected static int codatHashOffset
          Location of the hash value portion of the id within the byte array.
protected static int groupIdOffset
          Location of the group id in the byte array.
protected static int hashSize
          size of a SHA1 hash.
protected  IDBytes id
          The id data
protected static int idOffset
          Location of the randomly chosen portion of the id within the byte array.
protected static int padOffset
          Location of the begining of pad (unused space) within the byte array.
protected static int padSize
          Size of the pad.
 
Fields inherited from class net.jxta.id.ID
nullID, URIEncodingName, URNNamespace
 
Constructor Summary
protected CodatID()
          Internal constructor
protected CodatID(IDBytes id)
          Intializes contents from provided bytes.
  CodatID(PeerGroupID groupID)
          See IDFactory.Instantiator.newCodatID(net.jxta.peergroup.PeerGroupID).
  CodatID(PeerGroupID groupID, byte[] seed)
          See IDFactory.Instantiator.newCodatID(net.jxta.peergroup.PeerGroupID,byte[]).
  CodatID(PeerGroupID groupID, byte[] seed, InputStream in)
          See IDFactory.Instantiator.newCodatID(net.jxta.peergroup.PeerGroupID,InputStream).
  CodatID(PeerGroupID groupID, InputStream in)
          See IDFactory.Instantiator.newCodatID(net.jxta.peergroup.PeerGroupID,InputStream).
protected CodatID(UUID groupUUID, UUID idUUID)
           
 
Method Summary
 boolean equals(Object target)
          
 String getIDFormat()
          
 ID getPeerGroupID()
          
 Object getUniqueValue()
          
 URL getURL()
          
 int hashCode()
          
 boolean isStatic()
          
protected  void setHash(InputStream in)
          Calculates the SHA-1 hash of a stream.
 URI toURI()
          
 
Methods inherited from class net.jxta.id.ID
clone, create, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hashSize

protected static final int hashSize
size of a SHA1 hash. I would use MessageDigest.getDigestLength, but possible exceptions make it difficult to do.

See Also:
Constant Field Values

groupIdOffset

protected static final int groupIdOffset
Location of the group id in the byte array.

See Also:
Constant Field Values

idOffset

protected static final int idOffset
Location of the randomly chosen portion of the id within the byte array.

See Also:
Constant Field Values

codatHashOffset

protected static final int codatHashOffset
Location of the hash value portion of the id within the byte array.

See Also:
Constant Field Values

padOffset

protected static final int padOffset
Location of the begining of pad (unused space) within the byte array.

See Also:
Constant Field Values

padSize

protected static final int padSize
Size of the pad.

See Also:
Constant Field Values

id

protected IDBytes id
The id data

Constructor Detail

CodatID

protected CodatID()
Internal constructor


CodatID

protected CodatID(IDBytes id)
Intializes contents from provided bytes.

Parameters:
id - the ID data

CodatID

protected CodatID(UUID groupUUID,
                  UUID idUUID)

CodatID

public CodatID(PeerGroupID groupID)
See IDFactory.Instantiator.newCodatID(net.jxta.peergroup.PeerGroupID).


CodatID

public CodatID(PeerGroupID groupID,
               byte[] seed)
See IDFactory.Instantiator.newCodatID(net.jxta.peergroup.PeerGroupID,byte[]).


CodatID

public CodatID(PeerGroupID groupID,
               InputStream in)
        throws IOException
See IDFactory.Instantiator.newCodatID(net.jxta.peergroup.PeerGroupID,InputStream).

Throws:
IOException

CodatID

public CodatID(PeerGroupID groupID,
               byte[] seed,
               InputStream in)
        throws IOException
See IDFactory.Instantiator.newCodatID(net.jxta.peergroup.PeerGroupID,InputStream).

Throws:
IOException
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()

Specified by:
getIDFormat in class ID

getUniqueValue

public Object getUniqueValue()

Specified by:
getUniqueValue in class ID

getURL

public URL getURL()

Specified by:
getURL in class ID

getPeerGroupID

public ID getPeerGroupID()

Specified by:
getPeerGroupID in class CodatID

isStatic

public boolean isStatic()

Specified by:
isStatic in class CodatID

setHash

protected void setHash(InputStream in)
                throws IOException
Calculates the SHA-1 hash of a stream.

Parameters:
in - The InputStream.
Throws:
IOException

toURI

public URI toURI()

Overrides:
toURI in class ID

JXTA J2SE