类 DigestUtils


  • public abstract class DigestUtils
    extends java.lang.Object
    Miscellaneous methods for calculating digests.

    Mainly for internal use within the framework; consider Apache Commons Codec for a more comprehensive suite of digest utilities.

    从以下版本开始:
    3.0
    版本:
    $Id: $Id
    作者:
    Arjen Poutsma, Juergen Hoeller, Craig Andrews
    • 构造器概要

      构造器 
      构造器 说明
      DigestUtils()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      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 given StringBuilder.
      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 given StringBuilder.
      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.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • DigestUtils

        public DigestUtils()
    • 方法详细资料

      • md5Digest

        public static byte[] md5Digest​(byte[] bytes)
        Calculate the MD5 digest of the given bytes.
        参数:
        bytes - the bytes to calculate the digest over
        返回:
        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.

        参数:
        inputStream - the InputStream to calculate the digest over
        返回:
        the digest
        抛出:
        java.io.IOException - if any.
        从以下版本开始:
        4.2
      • md5DigestAsHex

        public static java.lang.String md5DigestAsHex​(byte[] bytes)
        Return a hexadecimal string representation of the MD5 digest of the given bytes.
        参数:
        bytes - the bytes to calculate the digest over
        返回:
        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.

        参数:
        inputStream - the InputStream to calculate the digest over
        返回:
        a hexadecimal digest string
        抛出:
        java.io.IOException - if any.
        从以下版本开始:
        4.2
      • 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 given StringBuilder.
        参数:
        bytes - the bytes to calculate the digest over
        builder - the string builder to append the digest to
        返回:
        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 given StringBuilder.

        This method does not close the input stream.

        参数:
        inputStream - the inputStream to calculate the digest over
        builder - the string builder to append the digest to
        返回:
        the given string builder
        抛出:
        java.io.IOException - if any.
        从以下版本开始:
        4.2