code: 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()));
      }
docs: Utility method to write given inputStream to given outputStream and compute the sha1 while transferring the bytes
  
  @param inputStream  the inputStream to copy from.
  @param outputStream the outputStream to write to.
  @return
  @throws IOException          thrown if there was a problem reading from inputStream or writing to outputStream.
  @throws InterruptedException thrown if the thread is interrupted which indicates cancelling.