Java version of Unix "file" utility?

Could someone point me toward a Java implementation of the file (1) utility? I need to examine uploaded files to make use they really are what their MIME type and extension say they are. Writing utility classes from scratch to read the magic number in the file header seems like reinventing the wheel.

thanks!

[322 byte] By [IBMSUXa] at [2007-11-27 5:07:30]
# 1
IBMDoesNotSuckTheyJustDroppedTheBall(AndTheirShorts),If you're on *nix and it doesn't need to be portable then just execute the file command and parse it's output.
corlettka at 2007-7-12 10:26:36 > top of Java-index,Java Essentials,Java Programming...
# 2

This might be of some help (uses the javax.activation.MimetypesFileTypeMap). Don't think it reads the magic numbers though.

http://blog.seesaw.it/articles/2006/09/09/getting-mime-type-from-a-file

If you're just trying to launch the file, you could use the 1.6 Desktop API:

http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html

kevjavaa at 2007-7-12 10:26:36 > top of Java-index,Java Essentials,Java Programming...
# 3
Thanks for the replies, but it looks like I may have to write it from scratch. Sigh.The projects "Java Mime Magic Library" an Aperature on SF look promising, though.
IBMSUXa at 2007-7-12 10:26:36 > top of Java-index,Java Essentials,Java Programming...
# 4
You can take the C version as a starting point.
BIJ001a at 2007-7-12 10:26:36 > top of Java-index,Java Essentials,Java Programming...