public static Sha256Hash of(File file) throws IOException {
  FileInputStream in=new FileInputStream(file);
  try {
    return of(ByteStreams.toByteArray(in));
  }
  finally {
    in.close();
  }
}

public static Sha256Hash of ( File file ) throws IOException { FileInputStream in = new FileInputStream ( file ) ; try { return of ( ByteStreams . toByteArray ( in ) ) ; } finally { in . close ( ) ; } }
creates a new instance containing the calculated ( one - time ) hash of the given file ' s contents . the file contents are read fully into memory , so this method should only be used with small files .
