Package org.apache.commons.io.input
Class MessageDigestInputStream.MessageDigestMaintainingObserver
java.lang.Object
org.apache.commons.io.input.ObservableInputStream.Observer
org.apache.commons.io.input.MessageDigestInputStream.MessageDigestMaintainingObserver
- Enclosing class:
- MessageDigestInputStream
public static class MessageDigestInputStream.MessageDigestMaintainingObserver
extends ObservableInputStream.Observer
Maintains the message digest.
-
Constructor Summary
ConstructorDescriptionMessageDigestMaintainingObserver
(MessageDigest messageDigest) Constructs an MessageDigestMaintainingObserver for the given MessageDigest. -
Method Summary
Modifier and TypeMethodDescriptionvoid
data
(byte[] input, int offset, int length) Called to indicate thatInputStream.read(byte[])
, orInputStream.read(byte[], int, int)
have been called, and are about to invoke data.void
data
(int input) Called to indicate, thatInputStream.read()
has been invoked on theObservableInputStream
, and will return a value.Methods inherited from class org.apache.commons.io.input.ObservableInputStream.Observer
closed, error, finished
-
Constructor Details
-
MessageDigestMaintainingObserver
Constructs an MessageDigestMaintainingObserver for the given MessageDigest.- Parameters:
messageDigest
- the message digest to use- Throws:
NullPointerException
- if messageDigest is null.
-
-
Method Details
-
data
Description copied from class:ObservableInputStream.Observer
Called to indicate thatInputStream.read(byte[])
, orInputStream.read(byte[], int, int)
have been called, and are about to invoke data.- Overrides:
data
in classObservableInputStream.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.
-
data
Description copied from class:ObservableInputStream.Observer
Called to indicate, thatInputStream.read()
has been invoked on theObservableInputStream
, and will return a value.- Overrides:
data
in classObservableInputStream.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.
-