Just add the following dependency in your pom.xml file:
<dependency>
<groupId>com.antkorwin</groupId>
<artifactId>mimetype</artifactId>
<version>0.1</version>
</dependency>
File file = new File("document.pdf");
String type = new MimeTypeResolver().get(file);
System.out.println(type);
this code prints : application/pdf
File file = new File("document.pdf");
String sha256 = new Sha256Resolver().get(file);
System.out.println(sha256);
this code prints the SHA-256 of the document.pdf
file :
bbf9546ec49f2bfe384a91cb5a33831c67a69fb8a7197346f261df0aa8f7a048