ro.isdc.wro.model.resource.support.hash
Class AbstractDigesterHashStrategy

java.lang.Object
  extended by ro.isdc.wro.model.resource.support.hash.AbstractDigesterHashStrategy
All Implemented Interfaces:
HashBuilder, HashStrategy
Direct Known Subclasses:
MD5HashStrategy, SHA1HashStrategy

public abstract class AbstractDigesterHashStrategy
extends Object
implements HashStrategy

Uses abstract digester for creating a hash.

Author:
Alex Objelean

Constructor Summary
AbstractDigesterHashStrategy()
           
 
Method Summary
 String getHash(InputStream input)
          
protected abstract  MessageDigest newMessageDigest()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDigesterHashStrategy

public AbstractDigesterHashStrategy()
Method Detail

getHash

public String getHash(InputStream input)
               throws IOException

Specified by:
getHash in interface HashBuilder
Parameters:
input - to digest.
Returns:
the hash of the content.
Throws:
IOException - if there was an error during reading the stream content.

newMessageDigest

protected abstract MessageDigest newMessageDigest()
                                           throws NoSuchAlgorithmException
Returns:
MessageDigest used for hashing.
Throws:
NoSuchAlgorithmException


Copyright © 2008-2013. All Rights Reserved.