public static MD5Hash digest(InputStream in) throws IOException {
    final byte[] buffer = new byte[4*1024]; 
    int fileLength = 0;

    final MessageDigest digester = DIGESTER_FACTORY.get();
    for(int n; (n = in.read(buffer)) != -1; ) {
      digester.update(buffer, 0, n);
      fileLength += n;
    }

    return new MD5Hash(digester.digest(), fileLength);
  }
public static MD5Hash digest ( InputStream in ) throws IOException { final byte [ ] buffer = new byte [ 4 * 1024 ] ; int fileLength = 0 ; final MessageDigest digester = DIGESTER_FACTORY . get ( ) ; for ( int n ; ( n = in . read ( buffer ) ) != - 1 ; ) { digester . update ( buffer , 0 , n ) ; fileLength += n ; } return new MD5Hash ( digester . digest ( ) , fileLength ) ; }
Construct a hash value for the content from the InputStream.