Class MessageDigestInputStream.Builder

    • Constructor Detail

      • Builder

        public Builder()
        Constructs a new Builder.
    • Method Detail

      • get

        public MessageDigestInputStream get()
                                     throws java.io.IOException
        Constructs a new instance.

        This builder use the aspects InputStream, OpenOption[], and MessageDigest.

        You must provide an origin that can be converted to an InputStream by this builder, otherwise, this call will throw an UnsupportedOperationException.

        Returns:
        a new instance.
        Throws:
        java.lang.UnsupportedOperationException - if the origin cannot provide an InputStream.
        java.io.IOException - if an I/O error occurs.
        See Also:
        AbstractStreamBuilder.getInputStream()
      • setMessageDigest

        public MessageDigestInputStream.Builder setMessageDigest​(java.security.MessageDigest messageDigest)
        Sets the message digest.

        The MD5 cryptographic algorithm is weak and should not be used.

        Parameters:
        messageDigest - the message digest.
        Returns:
        this
      • setMessageDigest

        public MessageDigestInputStream.Builder setMessageDigest​(java.lang.String algorithm)
                                                          throws java.security.NoSuchAlgorithmException
        Sets the name of the name of the message digest algorithm.

        The MD5 cryptographic algorithm is weak and should not be used.

        Parameters:
        algorithm - the name of the algorithm. See the MessageDigest section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names.
        Returns:
        this
        Throws:
        java.security.NoSuchAlgorithmException - if no Provider supports a MessageDigestSpi implementation for the specified algorithm.