org.codehaus.plexus.digest
Class AbstractDigester

java.lang.Object
  extended by org.codehaus.plexus.digest.AbstractDigester
All Implemented Interfaces:
Digester
Direct Known Subclasses:
Md5Digester, Sha1Digester

public abstract class AbstractDigester
extends java.lang.Object
implements Digester

Create a digest for a file.

Author:
Brett Porter

Field Summary
 
Fields inherited from interface org.codehaus.plexus.digest.Digester
ROLE
 
Constructor Summary
protected AbstractDigester(StreamingDigester streamingDigester)
           
 
Method Summary
 java.lang.String calc(java.io.File file)
          Calculate a checksum for a file.
 java.lang.String getAlgorithm()
          Get the algorithm used for the checksum.
 java.lang.String toString()
           
 void verify(java.io.File file, java.lang.String checksum)
          Verify that a checksum is correct.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractDigester

protected AbstractDigester(StreamingDigester streamingDigester)
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Description copied from interface: Digester
Get the algorithm used for the checksum.

Specified by:
getAlgorithm in interface Digester
Returns:
the algorithm

calc

public java.lang.String calc(java.io.File file)
                      throws DigesterException
Description copied from interface: Digester
Calculate a checksum for a file.

Specified by:
calc in interface Digester
Parameters:
file - the file to calculate the checksum for
Returns:
the current checksum.
Throws:
DigesterException - if there was a problem computing the hashcode.

verify

public void verify(java.io.File file,
                   java.lang.String checksum)
            throws DigesterException
Description copied from interface: Digester
Verify that a checksum is correct.

Specified by:
verify in interface Digester
Parameters:
file - the file to compute the checksum for
checksum - the checksum to compare to
Throws:
DigesterException - if there was a problem computing the hashcode.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001-2011 Codehaus. All Rights Reserved.