org.codehaus.plexus.digest

## Class AbstractStreamingDigester

- java.lang.Object
- - org.codehaus.plexus.digest.AbstractStreamingDigester

All Implemented Interfaces:
  StreamingDigester

Direct Known Subclasses:
  StreamingMd5Digester, StreamingSha1Digester

    public abstract class AbstractStreamingDigester
    extends Object
    implements StreamingDigester

Gradually create a digest for a stream.

Author:
  Brett Porter

### Field Summary

Fields
`protected MessageDigest` `md`

### Fields inherited from interface org.codehaus.plexus.digest.StreamingDigester

`ROLE`

### Constructor Summary

Constructors
`protected` `AbstractStreamingDigester(String algorithm)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`String` `calc()` Calculate the current checksum.
`protected static String` `calc(MessageDigest md)`
`String` `getAlgorithm()` Get the algorithm used for the checksum.
`void` `reset()` Reset the hashcode calculation algorithm.
`void` `update(InputStream is)` Update the checksum with the content of the input stream.
`protected static void` `update(InputStream is, MessageDigest digest)`

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

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

### Field Detail

#### md

    protected final MessageDigest md

### Constructor Detail

#### AbstractStreamingDigester

    protected AbstractStreamingDigester(String algorithm)

### Method Detail

#### getAlgorithm

    public String getAlgorithm()

Description copied from interface: `StreamingDigester`
Get the algorithm used for the checksum.

Specified by:
  `getAlgorithm` in interface `StreamingDigester`
Returns:
  the algorithm

#### calc

    public String calc()
                throws DigesterException

Description copied from interface: `StreamingDigester`
Calculate the current checksum.

Specified by:
  `calc` in interface `StreamingDigester`
Returns:
  the current checksum.
Throws:
  `DigesterException` - if there was a problem computing the hashcode.

#### reset

    public void reset()
               throws DigesterException

Description copied from interface: `StreamingDigester`
Reset the hashcode calculation algorithm. Only useful when performing incremental hashcodes based on repeated use of `StreamingDigester.update(InputStream)`

Specified by:
  `reset` in interface `StreamingDigester`
Throws:
  `DigesterException` - if there was a problem with the internal message digest

#### update

    public void update(InputStream is)
                throws DigesterException

Description copied from interface: `StreamingDigester`
Update the checksum with the content of the input stream.

Specified by:
  `update` in interface `StreamingDigester`
Parameters:
  `is` - the input stream
Throws:
  `DigesterException` - if there was a problem computing the hashcode.

#### calc

    protected static String calc(MessageDigest md)

#### update

    protected static void update(InputStream is,
                                 MessageDigest digest)
                          throws DigesterException

Throws:
  `DigesterException`