org.apache.commons.io.input

## Class MessageDigestCalculatingInputStream.MessageDigestMaintainingObserver

- java.lang.Object
- - org.apache.commons.io.input.ObservableInputStream.Observer
  - - org.apache.commons.io.input.MessageDigestCalculatingInputStream.MessageDigestMaintainingObserver

- Enclosing class:
    MessageDigestCalculatingInputStream

      public static class MessageDigestCalculatingInputStream.MessageDigestMaintainingObserver
      extends ObservableInputStream.Observer

  Maintains the message digest.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MessageDigestMaintainingObserver(MessageDigest messageDigest)` Creates an MessageDigestMaintainingObserver for the given MessageDigest.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `data(byte[] input, int offset, int length)` Called to indicate that `InputStream.read(byte[])`, or `InputStream.read(byte[], int, int)` have been called, and are about to invoke data.
    `void` | `data(int input)` Called to indicate, that `InputStream.read()` has been invoked on the `ObservableInputStream`, and will return a value.

    - ### Methods inherited from class org.apache.commons.io.input.ObservableInputStream.Observer

      `closed, error, finished`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MessageDigestMaintainingObserver

          public MessageDigestMaintainingObserver(MessageDigest messageDigest)

      Creates an MessageDigestMaintainingObserver for the given MessageDigest.
      Parameters:
        `messageDigest` - the message digest to use

  - ### Method Detail

    - #### data

          public void data(int input)
                    throws IOException

      Description copied from class: `ObservableInputStream.Observer`
      Called to indicate, that `InputStream.read()` has been invoked on the `ObservableInputStream`, and will return a value.
      Overrides:
        `data` in class `ObservableInputStream.Observer`
      Parameters:
        `input` - The value, which is being returned. This will never be -1 (EOF), because, in that case, `ObservableInputStream.Observer.finished()` will be invoked instead.
      Throws:
        `IOException` - if an I/O error occurs.

    - #### data

          public void data(byte[] input,
                           int offset,
                           int length)
                    throws IOException

      Description copied from class: `ObservableInputStream.Observer`
      Called to indicate that `InputStream.read(byte[])`, or `InputStream.read(byte[], int, int)` have been called, and are about to invoke data.
      Overrides:
        `data` in class `ObservableInputStream.Observer`
      Parameters:
        `input` - The byte array, which has been passed to the read call, and where data has been stored.
        `offset` - The offset within the byte array, where data has been stored.
        `length` - The number of bytes, which have been stored in the byte array.
      Throws:
        `IOException` - if an I/O error occurs.

Copyright © 2002–2021 The Apache Software Foundation. All rights reserved.