We often want to quickly identify the type of a file. The following two libraries help us achieve that goal.
jMimeMagic is a Java library for determining the MIME type of files or streams.
Enable Java programs to detect MIME types based on file extensions, magic data and content sniffing. Supports detection from java.io.File, java.io.InputStream, java.net.URL and byte arrays.