Package org.fcrepo.kernel.api.utils
Class ContentDigest
- java.lang.Object
-
- org.fcrepo.kernel.api.utils.ContentDigest
-
public final class ContentDigest extends Object
Digest helpers to convert digests (checksums) into URI strings (based loosely on Magnet URIs)- Since:
- Mar 6, 2013
- Author:
- Chris Beer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContentDigest.DIGEST_ALGORITHM
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ALGORITHMstatic ContentDigest.DIGEST_ALGORITHMDEFAULT_DIGEST_ALGORITHM
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static URIasURI(String algorithm, byte[] data)Convert a MessageDigest algorithm and checksum byte-array data to a URNstatic URIasURI(String algorithm, String value)Convert a MessageDigest algorithm and checksum value to a URNstatic StringgetAlgorithm(URI digestUri)Given a digest URI, get the corresponding MessageDigest algorithmstatic URImissingChecksum()Placeholder checksum value.
-
-
-
Field Detail
-
DEFAULT_DIGEST_ALGORITHM
public static final ContentDigest.DIGEST_ALGORITHM DEFAULT_DIGEST_ALGORITHM
-
DEFAULT_ALGORITHM
public static final String DEFAULT_ALGORITHM
-
-
Method Detail
-
asURI
public static URI asURI(String algorithm, String value)
Convert a MessageDigest algorithm and checksum value to a URN- Parameters:
algorithm- the message digest algorithmvalue- the checksum value- Returns:
- URI
-
asURI
public static URI asURI(String algorithm, byte[] data)
Convert a MessageDigest algorithm and checksum byte-array data to a URN- Parameters:
algorithm- the message digest algorithmdata- the checksum byte-array data- Returns:
- URI
-
getAlgorithm
public static String getAlgorithm(URI digestUri)
Given a digest URI, get the corresponding MessageDigest algorithm- Parameters:
digestUri- the digest uri- Returns:
- MessageDigest algorithm
-
missingChecksum
public static URI missingChecksum()
Placeholder checksum value.- Returns:
- URI
-
-