|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.util.magicfile.MagicFile
Tries to determine the mime-type of a byte array (or a file).
| Field Summary | |
protected static int |
BUFSIZE
|
protected DetectorProvider |
detectors
|
static String |
FAILED
|
| Method Summary | |
String |
extensionToMimeType(String extension)
|
List |
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)
|
protected String |
getMimeType(File file)
|
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)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String FAILED
protected static int BUFSIZE
protected DetectorProvider detectors
| Method Detail |
public static MagicFile getInstance()
public List getDetectors()
protected String test(String path)
protected String getMimeType(File file)
throws IOException
file - Location of file to be checked
IOExceptionpublic String getMimeType(byte[] input)
public String extensionToMimeType(String extension)
public String mimeTypeToExtension(String mimeType)
public String getMimeType(byte[] data,
String extension)
public static void main(String[] argv)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||