Class MessageDigestCalculatingInputStream

    • Field Detail

      • messageDigest

        private final java.security.MessageDigest messageDigest
    • Constructor Detail

      • MessageDigestCalculatingInputStream

        public MessageDigestCalculatingInputStream​(java.io.InputStream pStream,
                                                   java.security.MessageDigest pDigest)
        Creates a new instance, which calculates a signature on the given stream, using the given MessageDigest.
        Parameters:
        pStream - the stream to calculate the message digest for
        pDigest - the message digest to use
      • MessageDigestCalculatingInputStream

        public MessageDigestCalculatingInputStream​(java.io.InputStream pStream,
                                                   java.lang.String pAlgorithm)
                                            throws java.security.NoSuchAlgorithmException
        Creates a new instance, which calculates a signature on the given stream, using a MessageDigest with the given algorithm.
        Parameters:
        pStream - the stream to calculate the message digest for
        pAlgorithm - the name of the algorithm to use
        Throws:
        java.security.NoSuchAlgorithmException - if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
      • MessageDigestCalculatingInputStream

        public MessageDigestCalculatingInputStream​(java.io.InputStream pStream)
                                            throws java.security.NoSuchAlgorithmException
        Creates a new instance, which calculates a signature on the given stream, using a MessageDigest with the "MD5" algorithm.
        Parameters:
        pStream - the stream to calculate the message digest for
        Throws:
        java.security.NoSuchAlgorithmException - if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
    • Method Detail

      • getMessageDigest

        public java.security.MessageDigest getMessageDigest()
        Returns the MessageDigest, which is being used for generating the checksum. Note: The checksum will only reflect the data, which has been read so far. This is probably not, what you expect. Make sure, that the complete data has been read, if that is what you want. The easiest way to do so is by invoking ObservableInputStream.consume().
        Returns:
        the message digest used