## 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 java.lang.Object
implements StreamingDigester

Gradually create a digest for a stream.

Author:
  Brett Porter

Field Summary
`protected java.security.MessageDigest` `md`

Fields inherited from interface org.codehaus.plexus.digest.StreamingDigester
`ROLE`

Constructor Summary
`protected` `AbstractStreamingDigester(java.lang.String algorithm)`

Method Summary
`java.lang.String` `calc()` Calculate the current checksum.
`protected static java.lang.String` `calc(java.security.MessageDigest md)`
`java.lang.String` `getAlgorithm()` Get the algorithm used for the checksum.
`void` `reset()` Reset the hashcode calculation algorithm.
`void` `update(java.io.InputStream is)` Update the checksum with the content of the input stream.
`protected static void` `update(java.io.InputStream is, java.security.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 java.security.MessageDigest md

Constructor Detail

### AbstractStreamingDigester

    protected AbstractStreamingDigester(java.lang.String algorithm)

Method Detail

### getAlgorithm

    public java.lang.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 java.lang.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(java.io.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 java.lang.String calc(java.security.MessageDigest md)

### update

    protected static void update(java.io.InputStream is,
                                 java.security.MessageDigest digest)
                          throws DigesterException

  Throws:
    `DigesterException`

Copyright © 2011. All Rights Reserved.