eu.scape_project.core.model
Class JavaDigestValue

java.lang.Object
  extended by eu.scape_project.core.model.JavaDigestValue
All Implemented Interfaces:
DigestValue, Serializable

public class JavaDigestValue
extends Object
implements DigestValue, Serializable

Author:
Carl Wilson carlwilson-bl@SourceForge carlwilson-bl@github
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface eu.scape_project.core.api.DigestValue
DigestValue.DigestAlgorithm
 
Method Summary
static Set<JavaDigestValue> createDigestSet(Set<DigestValue.DigestAlgorithm> algorithms, InputStream is)
           
 boolean equals(Object obj)
           
 URI getAlgorithmId()
           
 byte[] getDigest()
           
 String getHexDigest()
           
static JavaDigestValue getInstance(DigestValue.DigestAlgorithm algorithm, byte[] digest)
           
static JavaDigestValue getInstance(DigestValue.DigestAlgorithm algorithm, File file)
           
static JavaDigestValue getInstance(DigestValue.DigestAlgorithm algorithm, InputStream byteStream)
           
static JavaDigestValue getInstance(DigestValue.DigestAlgorithm algorithm, String hexDigest)
           
static JavaDigestValue getInstance(String xml)
           
 int hashCode()
           
 String toString()
           
 String toXml()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getAlgorithmId

public URI getAlgorithmId()
Specified by:
getAlgorithmId in interface DigestValue
Returns:
the algorithm id for the digest as a java.net.URI

getHexDigest

public String getHexDigest()
Specified by:
getHexDigest in interface DigestValue
Returns:
the hex value of the digest as a java.lang.String

getDigest

public byte[] getDigest()
Specified by:
getDigest in interface DigestValue
Returns:
the digest value as a byte[]

toXml

public String toXml()
             throws JAXBException
Returns:
a String xml representation of the object
Throws:
JAXBException

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

getInstance

public static JavaDigestValue getInstance(String xml)
                                   throws JAXBException
Parameters:
xml -
Returns:
a new JavaDigestValue object serialized from XML
Throws:
JAXBException

getInstance

public static JavaDigestValue getInstance(DigestValue.DigestAlgorithm algorithm,
                                          byte[] digest)
Parameters:
algorithm - the DigestAlgorithm to use
digest - the calculated digest byte array
Returns:
a new JavaDigestValue object.

getInstance

public static JavaDigestValue getInstance(DigestValue.DigestAlgorithm algorithm,
                                          String hexDigest)
Parameters:
algorithm - the DigestAlgorithm to use
hexDigest - the calculated digest hex string
Returns:
a new JavaDigestValue object.

getInstance

public static JavaDigestValue getInstance(DigestValue.DigestAlgorithm algorithm,
                                          InputStream byteStream)
                                   throws IOException,
                                          NoSuchAlgorithmException
Parameters:
byteStream -
algorithm -
Returns:
a new JavaDigestValue object
Throws:
IOException
NoSuchAlgorithmException

getInstance

public static JavaDigestValue getInstance(DigestValue.DigestAlgorithm algorithm,
                                          File file)
                                   throws FileNotFoundException,
                                          IOException,
                                          NoSuchAlgorithmException
Parameters:
file -
algorithm -
Returns:
a new JavaDigestValue object
Throws:
FileNotFoundException
IOException
NoSuchAlgorithmException

createDigestSet

public static Set<JavaDigestValue> createDigestSet(Set<DigestValue.DigestAlgorithm> algorithms,
                                                   InputStream is)
                                            throws NoSuchAlgorithmException,
                                                   IOException
Parameters:
algorithms - a set of algorithms to calculate
is - an input stream to calc some digests from
Returns:
a set of digests values calculated from the stream
Throws:
NoSuchAlgorithmException
IOException


Copyright © 2013. All Rights Reserved.