Curious what the best way is in Java to get the mime-type of a file. It should actually inspect the file because filenames aren't an accurate indicator.
Currently I'm using the following which seems to be very hit or miss
  is = new BufferedInputStream(new FileInputStream(fileName));
  String mimeType = URLConnection.guessContentTypeFromStream(is);
  if(mimeType == null) {
    throw new IOException("can't get mime type of image");
  }