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