Package com.aspectran.core.util
Class DigestUtils
- java.lang.Object
-
- com.aspectran.core.util.DigestUtils
-
public abstract class DigestUtils extends java.lang.Object
This class is a clone of org.springframework.util.DigestUtils
Miscellaneous methods for calculating digests.Mainly for internal use within the framework; consider Apache Commons Codec for a more comprehensive suite of digest utilities.
- Author:
- Arjen Poutsma, Juergen Hoeller, Craig Andrews
-
-
Constructor Summary
Constructors Constructor Description DigestUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringBuilder
appendMd5DigestAsHex(byte[] bytes, java.lang.StringBuilder builder)
Append a hexadecimal string representation of the MD5 digest of the given bytes to the givenStringBuilder
.static java.lang.StringBuilder
appendMd5DigestAsHex(java.io.InputStream inputStream, java.lang.StringBuilder builder)
Append a hexadecimal string representation of the MD5 digest of the given inputStream to the givenStringBuilder
.static byte[]
md5Digest(byte[] bytes)
Calculate the MD5 digest of the given bytes.static byte[]
md5Digest(java.io.InputStream inputStream)
Calculate the MD5 digest of the given stream.static java.lang.String
md5DigestAsHex(byte[] bytes)
Return a hexadecimal string representation of the MD5 digest of the given bytes.static java.lang.String
md5DigestAsHex(java.io.InputStream inputStream)
Return a hexadecimal string representation of the MD5 digest of the given stream.
-
-
-
Method Detail
-
md5Digest
public static byte[] md5Digest(byte[] bytes)
Calculate the MD5 digest of the given bytes.- Parameters:
bytes
- the bytes to calculate the digest over- Returns:
- the digest
-
md5Digest
public static byte[] md5Digest(java.io.InputStream inputStream) throws java.io.IOException
Calculate the MD5 digest of the given stream.This method does not close the input stream.
- Parameters:
inputStream
- the InputStream to calculate the digest over- Returns:
- the digest
- Throws:
java.io.IOException
-
md5DigestAsHex
public static java.lang.String md5DigestAsHex(byte[] bytes)
Return a hexadecimal string representation of the MD5 digest of the given bytes.- Parameters:
bytes
- the bytes to calculate the digest over- Returns:
- a hexadecimal digest string
-
md5DigestAsHex
public static java.lang.String md5DigestAsHex(java.io.InputStream inputStream) throws java.io.IOException
Return a hexadecimal string representation of the MD5 digest of the given stream.This method does not close the input stream.
- Parameters:
inputStream
- the InputStream to calculate the digest over- Returns:
- a hexadecimal digest string
- Throws:
java.io.IOException
-
appendMd5DigestAsHex
public static java.lang.StringBuilder appendMd5DigestAsHex(byte[] bytes, java.lang.StringBuilder builder)
Append a hexadecimal string representation of the MD5 digest of the given bytes to the givenStringBuilder
.- Parameters:
bytes
- the bytes to calculate the digest overbuilder
- the string builder to append the digest to- Returns:
- the given string builder
-
appendMd5DigestAsHex
public static java.lang.StringBuilder appendMd5DigestAsHex(java.io.InputStream inputStream, java.lang.StringBuilder builder) throws java.io.IOException
Append a hexadecimal string representation of the MD5 digest of the given inputStream to the givenStringBuilder
.This method does not close the input stream.
- Parameters:
inputStream
- the inputStream to calculate the digest overbuilder
- the string builder to append the digest to- Returns:
- the given string builder
- Throws:
java.io.IOException
-
-