IT. Expert System.

Android Reference

DigestInputStream


java.security

Class DigestInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable


    public class DigestInputStream
    extends FilterInputStream
    DigestInputStream is a FilterInputStream which maintains an associated message digest.
    • Field Detail

      • digest

        protected MessageDigest digest
        The message digest for this stream.
    • Constructor Detail

      • DigestInputStream

        public DigestInputStream(InputStream stream,
                         MessageDigest digest)
        Constructs a new instance of this DigestInputStream, using the given stream and the digest.

        Warning: passing a null source creates an invalid DigestInputStream. All operations on such a stream will fail.

        Parameters:
        stream - the input stream.
        digest - the message digest.
    • Method Detail

      • getMessageDigest

        public MessageDigest getMessageDigest()
        Returns the message digest for this stream.
        Returns:
        the message digest for this stream.
      • setMessageDigest

        public void setMessageDigest(MessageDigest digest)
        Sets the message digest which this stream will use.
        Parameters:
        digest - the message digest which this stream will use.
      • read

        public int read()
                 throws IOException
        Reads the next byte and returns it as an int. Updates the digest for the byte if this function is on(boolean).

        This operation is blocking.

        Overrides:
        read in class FilterInputStream
        Returns:
        the byte which was read or -1 at end of stream.
        Throws:
        IOException - if reading the source stream causes an IOException.
      • read

        public int read(byte[] b,
               int off,
               int len)
                 throws IOException
        Reads len bytes into the specified byte[], starting from the specified offset. Updates the digest if this function is on(boolean).

        This operation is blocking.

        Overrides:
        read in class FilterInputStream
        Parameters:
        b - the byte array in which to store the bytes
        off - the initial position in b to store the bytes read from this stream
        len - the maximum number of bytes to store in b
        Returns:
        the number of bytes actually read or -1 if the end of the filtered stream has been reached while reading
        Throws:
        IOException - if reading the source stream causes an IOException
      • on

        public void on(boolean on)
        Enables or disables the digest function (default is on).
        Parameters:
        on - true if the digest should be computed, false otherwise.
        See Also:
        MessageDigest
      • toString

        public String toString()
        Returns a string containing a concise, human-readable description of this DigestInputStream including the digest.
        Overrides:
        toString in class Object
        Returns:
        a printable representation for this DigestInputStream.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 156 / 158679167. Delta: 0.04582 с