public class ContentStreamHashImpl extends Object implements ContentStreamHash
Modifier and Type | Field and Description |
---|---|
static String |
ALGORITHM_MD5 |
static String |
ALGORITHM_SHA1 |
static String |
ALGORITHM_SHA224 |
static String |
ALGORITHM_SHA256 |
static String |
ALGORITHM_SHA3 |
static String |
ALGORITHM_SHA384 |
static String |
ALGORITHM_SHA512 |
Constructor and Description |
---|
ContentStreamHashImpl(String propertyValue)
Constructs an object from the
cmis:contentStreamHash property
value. |
ContentStreamHashImpl(String algorithm,
String hash)
Constructs an object from the algorithm and hash.
|
Modifier and Type | Method and Description |
---|---|
protected static String |
byteArrayToHexString(byte[] bytes) |
static List<ContentStreamHash> |
createContentStreamHashes(InputStream stream,
String... algorithm)
Creates a list of content hashes from a stream
|
String |
getAlgorithm()
Returns the hash algorithm.
|
String |
getHash()
Returns the hash value.
|
String |
getPropertyValue()
Returns the content hash property value (
cmis:contentStreamHash ). |
public static final String ALGORITHM_MD5
public static final String ALGORITHM_SHA1
public static final String ALGORITHM_SHA224
public static final String ALGORITHM_SHA256
public static final String ALGORITHM_SHA384
public static final String ALGORITHM_SHA512
public static final String ALGORITHM_SHA3
public ContentStreamHashImpl(String propertyValue)
cmis:contentStreamHash
property
value.propertyValue
- the property valuepublic String getPropertyValue()
ContentStreamHash
cmis:contentStreamHash
).getPropertyValue
in interface ContentStreamHash
public String getAlgorithm()
ContentStreamHash
getAlgorithm
in interface ContentStreamHash
null
if the property value is
invalidpublic String getHash()
ContentStreamHash
getHash
in interface ContentStreamHash
null
if the property value is invalidpublic static List<ContentStreamHash> createContentStreamHashes(InputStream stream, String... algorithm) throws IOException, NoSuchAlgorithmException
This method consumes the stream but doesn't close it.
stream
- the streamalgorithm
- the algorithmsIOException
NoSuchAlgorithmException
protected static String byteArrayToHexString(byte[] bytes)
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.