MimeTypeIdentifier identifier = new MagicMimeTypeIdentifier();
// Read as many bytes of the file as desired by the MIME-type identifier
int minimumArrayLength = identifier.getMinArrayLength();
byte[] bytes = IOUtil.readBytes(content, minimumArrayLength);
// let the MimeTypeIdentifier determine the MIME-type of this file
return identifier.identify(bytes, name, null);
}
}