wro4j-core/src/main/java/ro/isdc/wro/model/resource/support/hash/CRC32HashStrategy.java
public String getHash(final InputStream input)
    throws IOException {
    if (input == null) {
      throw new IllegalArgumentException("Content cannot be null!");
    }
    try{
      LOG.debug("creating hash using CRC32 algorithm");
      final Checksum checksum = new CRC32();
      final byte[] bytes = new byte[1024];
      int len = 0;
      while ((len = input.read(bytes)) >= 0) {
        checksum.update(bytes, 0, len);
      }

      final String hash = new BigInteger(Long.toString(checksum.getValue())).toString(16);
      LOG.debug("CRC32 hash: {}", hash);
      return hash;
    }finally{
      IOUtils.closeQuietly(input);
    }
  }
public String getHash(final InputStream input)
    throws IOException {
    if (input == null) {
      throw new IllegalArgumentException("Content cannot be null!");
    }
    try{
      LOG.debug("creating hash using CRC32 algorithm");
      final Checksum checksum = new CRC32();
      final byte[] bytes = new byte[1024];
      int len = 0;
      while ((len = input.read(bytes)) >= 0) {
        checksum.update(bytes, 0, len);
      }

      final String hash = new BigInteger(Long.toString(checksum.getValue())).toString(16);
      LOG.debug("CRC32 hash: {}", hash);
      return hash;
    }finally{
      IOUtils.closeQuietly(input);
    }
  }
public String getHash ( final InputStream input ) throws IOException { if ( input == null ) { throw new IllegalArgumentException ( "Content cannot be null!" ) ; } try { LOG . debug ( "creating hash using CRC32 algorithm" ) ; final Checksum checksum = new CRC32 ( ) ; final byte [ ] bytes = new byte [ 1024 ] ; int len = 0 ; while ( ( len = input . read ( bytes ) ) >= 0 ) { checksum . update ( bytes , 0 , len ) ; } final String hash = new BigInteger ( Long . toString ( checksum . getValue ( ) ) ) . toString ( 16 ) ; LOG . debug ( "CRC32 hash: {}" , hash ) ; return hash ; } finally { IOUtils . closeQuietly ( input ) ; } }
{@inheritDoc}
{