org.asunder.content
Class CHKContentManager

java.lang.Object
  extended by org.asunder.content.AsunderContentManager
      extended by org.asunder.content.CHKContentManager

public class CHKContentManager
extends AsunderContentManager

Author:
simms2k

Constructor Summary
CHKContentManager(CHKContent content)
          Creates a new instance of CHKContentManager
 
Method Summary
 byte[] computeDataDigest()
          Sets the content's kbrId to the data digest Called on locally created CHKContent to prepare it for transport This can be processor intensive, so be sure to run in a thread
static CHKContent generateCHKContent(byte[] data)
           
 DHTContentKey getContentKey()
           
 byte[] getDataDigest()
          get the (not necessarily verified) data digest
 boolean verifyContent()
           
 boolean verifyDataDigest()
          Verifies the digest of content that has been received by the local node
 
Methods inherited from class org.asunder.content.AsunderContentManager
getManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CHKContentManager

public CHKContentManager(CHKContent content)
Creates a new instance of CHKContentManager

Method Detail

getDataDigest

public byte[] getDataDigest()
get the (not necessarily verified) data digest


computeDataDigest

public byte[] computeDataDigest()
                         throws java.io.IOException,
                                java.security.NoSuchAlgorithmException
Sets the content's kbrId to the data digest Called on locally created CHKContent to prepare it for transport This can be processor intensive, so be sure to run in a thread

Returns:
the computed digest
Throws:
java.io.IOException
java.security.NoSuchAlgorithmException

verifyDataDigest

public boolean verifyDataDigest()
                         throws java.io.IOException,
                                java.security.NoSuchAlgorithmException
Verifies the digest of content that has been received by the local node

Returns:
whether the digest is correct
Throws:
java.io.IOException
java.security.NoSuchAlgorithmException

getContentKey

public DHTContentKey getContentKey()

verifyContent

public boolean verifyContent()
                      throws java.io.IOException,
                             java.security.NoSuchAlgorithmException
Specified by:
verifyContent in class AsunderContentManager
Throws:
java.io.IOException
java.security.NoSuchAlgorithmException

generateCHKContent

public static CHKContent generateCHKContent(byte[] data)
                                     throws java.io.IOException,
                                            java.security.NoSuchAlgorithmException
Throws:
java.io.IOException
java.security.NoSuchAlgorithmException