net.tomp2p.rpc
Class DigestInfo

java.lang.Object
  extended by net.tomp2p.rpc.DigestInfo

public class DigestInfo
extends Object

Calculates or sets a global hash. The digest is used in two places: for routing, where a message needs to have a predictable size. Thus in this case a global hash is calculated. The second usage is get() for getting a list of hashes from peers. Here we don't need to restrict ourself, since we use TCP.

Author:
Thomas Bocek

Constructor Summary
DigestInfo()
          Empty constructor is used to add the hashes to the list.
DigestInfo(Number160 keyDigest, int size)
          If a global hash has already been calculated, then this constructor is used to store those.
 
Method Summary
 boolean equals(Object obj)
           
 Number160 getKeyDigest()
           
 List<Number160> getKeyDigests()
           
 int getSize()
           
 int hashCode()
           
 boolean isEmpty()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DigestInfo

public DigestInfo()
Empty constructor is used to add the hashes to the list.


DigestInfo

public DigestInfo(Number160 keyDigest,
                  int size)
If a global hash has already been calculated, then this constructor is used to store those. Note that once a global hash is set it cannot be unset.

Parameters:
keyDigest -
size -
Method Detail

getKeyDigest

public Number160 getKeyDigest()
Returns:
Returns or calculates the global hash. The global hash will be calculated if the empty constructor is used.

getKeyDigests

public List<Number160> getKeyDigests()
Returns:
The list of hashes

getSize

public int getSize()
Returns:
The number of hashes

isEmpty

public boolean isEmpty()
Returns:
True is the digest information has not been provided.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2012. All Rights Reserved.