eu.scape_project.core.model
Class JavaDigestValue
java.lang.Object
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
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 usedigest
- 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 usehexDigest
- 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 calculateis
- 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.