Interface Digest


  • public interface Digest
    Interface on a message Digest.
    Since:
    5.4M1
    Version:
    $Id: 81ec566c1191437cb24b17ed9b49562f483acc6e $
    • Method Detail

      • getAlgorithmName

        String getAlgorithmName()
        Returns:
        the algorithm name of the underlying digest.
      • getDigestSize

        int getDigestSize()
        Returns:
        the size of the digest produced by this message digest (in bytes).
      • getParameters

        DigestParameters getParameters()
        Returns:
        if any, return the parameters of this digest.
      • getInputStream

        FilterInputStream getInputStream​(InputStream is)
        Return a filtered input stream computing byte read into a digest. The digest is reset each time this function is called. Any previously retrieved input stream or in progress operation should therefore be discarded.
        Parameters:
        is - an input stream to read and calculate digest from. Call digest() to get the digest.
        Returns:
        a filtered input stream based calculating digest of bytes read.
      • getOutputStream

        OutputStream getOutputStream()
        Return an output stream to this digest. The digest is reset each time this function is called. Any previously retrieved input stream or in progress operation should therefore be discarded.
        Returns:
        avn output stream writing to this digest.
      • update

        void update​(byte[] input)
        Continues a multiple-part digest operation, processing another data part.
        Parameters:
        input - the input buffer.
      • update

        void update​(byte[] input,
                    int inputOffset,
                    int inputLen)
        Continues a multiple-part digest operation, processing another data part.
        Parameters:
        input - the input buffer.
        inputOffset - the offset in input where the input starts.
        inputLen - the input length.
      • digest

        byte[] digest()
        Finishes a multiple-part digest operation, and produce the resulting digest. Upon finishing, this method resets this digest.
        Returns:
        a new buffer with the resulting digest.
      • digest

        byte[] digest​(byte[] input)
        Finishes a multiple-part digest operation, and produce the resulting digest. Upon finishing, this method resets this digest.
        Parameters:
        input - the input buffer.
        Returns:
        a new buffer with the resulting digest.
      • digest

        byte[] digest​(byte[] input,
                      int inputOffset,
                      int inputLen)
        Finishes a multiple-part digest operation, and produce the resulting digest. Upon finishing, this method resets this digest.
        Parameters:
        input - the input buffer.
        inputOffset - the offset in input where the input starts.
        inputLen - the input length.
        Returns:
        a new buffer with the resulting digest.
      • getEncoded

        byte[] getEncoded()
                   throws IOException
        Serialize the definition of this digest. This serialization could be provided to an appropriate factory (like the one that have been used to create this digest) to produce an equivalent digest. The serialization contains the digest algorithm. For best interoperability, the recommended encoding is ASN.1 in DER format.
        Returns:
        an encoded definition of this digest.
        Throws:
        IOException - on error