public static String copyStreamAndComputeSha1 ( final InputStream inputStream , final OutputStream outputStream ) throws NoSuchAlgorithmException , IOException , InterruptedException { MessageDigest md = MessageDigest . getInstance ( "SHA-1" ) ; copyStream ( inputStream , outputStream , md ) ; return new String ( encodeHex ( md . digest ( ) ) ) ; }
Utility method to write given inputStream to given outputStream and compute the sha1 while transferring the bytes