code: public static String computeHashSHA256(final InputStream input)
              throws IOException {
          if (input == null) {
              throw new InvalidArgument("input", input);
          }
  
          MessageDigest sha256;
          try {
              sha256 = MessageDigest.getInstance("SHA-256");
          } catch (NoSuchAlgorithmException e) {
              throw new MissingAlgorithmException(SHA_256, e);
          }
  
          final DigestInputStream dis = new DigestInputStream(input, sha256);
          while (dis.read() != -1) {}
  
          byte[] mdbytes = sha256.digest();
  
          StringBuffer sb = new StringBuffer();
          for (int i = 0; i < mdbytes.length; i++) {
              sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16)
                      .substring(1));
          }
  
          return sb.toString();
      }
docs: Computes a SHA-256 hash of data from the {@link InputStream input}.
  
  @param input the data {@link InputStream input stream}, which cannot be
  {@code null}
  @return the {@link String SHA-256 hash}
  @throws IOException Thrown if an IO error occurred reading from the
  {@link InputStream input}
  @throws InvalidArgument Thrown if {@code input} is {@code null}