org.apache.tika tika-core 1.18
Next, we’ll make use of the detect() method to resolve the type:
@Test
public void whenUsingTika_thenSuccess() {
File file = new File(“product.png”);
Tika tika = new Tika();
String mimeType = tika.detect(file);
assertEquals(mimeType, “image/png”);
}