ro.isdc.wro.model.resource.util
Class HashEncoderNamingStrategy

java.lang.Object
  extended by ro.isdc.wro.model.resource.util.HashEncoderNamingStrategy
All Implemented Interfaces:
NamingStrategy

public class HashEncoderNamingStrategy
extends Object
implements NamingStrategy

The simplest implementation of NamingStrategy which encodes the hash code into the name of the resource. For instance: For group.js -> group-.js. This implementation uses by default CRC32HashBuilder implementation.

Author:
Alex Objelean

Constructor Summary
HashEncoderNamingStrategy()
           
 
Method Summary
protected  HashBuilder newHashBuilder()
           
 String rename(String originalName, InputStream inputStream)
          Creates a new name of the resource which encodes a version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashEncoderNamingStrategy

public HashEncoderNamingStrategy()
Method Detail

newHashBuilder

protected HashBuilder newHashBuilder()
Returns:
an implementation of HashBuilder.

rename

public String rename(String originalName,
                     InputStream inputStream)
              throws IOException
Creates a new name of the resource which encodes a version.

Specified by:
rename in interface NamingStrategy
Parameters:
originalName - original name of the resource.
inputStream - the stream of the content to rename.
Returns:
new name of the resource with version encoded.
Throws:
IOException - if there are stream reading problem.


Copyright © 2008-2011. All Rights Reserved.