jmimemagic

jMimeMagic is a Java library for determining the content type of files or streams.