public class MagicFile extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BUFSIZE |
protected DetectorProvider |
detectors |
static String |
FAILED |
| Modifier and Type | Method and Description |
|---|---|
String |
extensionToMimeType(String extension) |
List<Detector> |
getDetectors()
Returns a list of detectors used by this MagicFile instance
|
static MagicFile |
getInstance()
Return the current instance of MagicFile.
|
String |
getMimeType(byte[] input)
Tests the byte[] array for the mime type.
|
String |
getMimeType(byte[] data,
String extension) |
String |
getMimeType(File file) |
String |
getMimeType(InputStream input) |
static void |
main(String[] argv)
e.g.: java -Dmmbase.config=/home/mmbase/mmbase-app/WEB-INF/config org.mmbase.util.MagicFile test.doc
|
String |
mimeTypeToExtension(String mimeType)
Given a mime-type string, this function tries to create a common extension for it.
|
protected String |
test(String path) |
protected static final int BUFSIZE
public static final String FAILED
protected final DetectorProvider detectors
public static MagicFile getInstance()
public List<Detector> getDetectors()
public String getMimeType(File file) throws IOException
file - Location of file to be checkedIOExceptionpublic String getMimeType(byte[] input)
public String getMimeType(InputStream input) throws IOException
IOExceptionpublic String mimeTypeToExtension(String mimeType)
public static void main(String[] argv)
MMBase 1.9-SNAPSHOT - ${javadoctimestamp}