Package adams.core.net
Class MimeTypeHelper
- java.lang.Object
-
- adams.core.net.MimeTypeHelper
-
public class MimeTypeHelper extends Object
Helper class for mime types.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static String
MIMETYPE_APPLICATION_OCTETSTREAM
mime type: application/octet-stream.static String
MIMETYPE_PLAIN_TEXT
mime type: plain/text.
-
Constructor Summary
Constructors Constructor Description MimeTypeHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.tika.mime.MediaType
getMimeType(File file)
Tries to determine the MIME type of a file by checking its magic bytes.static org.apache.tika.mime.MediaType
getMimeType(String filename)
Tries to determine the MIME type of a file by checking its magic bytes.
-
-
-
Field Detail
-
MIMETYPE_APPLICATION_OCTETSTREAM
public static final String MIMETYPE_APPLICATION_OCTETSTREAM
mime type: application/octet-stream.- See Also:
- Constant Field Values
-
MIMETYPE_PLAIN_TEXT
public static final String MIMETYPE_PLAIN_TEXT
mime type: plain/text.- See Also:
- Constant Field Values
-
-
Method Detail
-
getMimeType
public static org.apache.tika.mime.MediaType getMimeType(File file)
Tries to determine the MIME type of a file by checking its magic bytes. Taken from here: http://stackoverflow.com/a/16626396.- Parameters:
file
- the file to check- Returns:
- the MIME type,
MediaType.OCTET_STREAM
if it fails
-
getMimeType
public static org.apache.tika.mime.MediaType getMimeType(String filename)
Tries to determine the MIME type of a file by checking its magic bytes. Taken from here: http://stackoverflow.com/a/16626396.- Parameters:
filename
- the file to check- Returns:
- the MIME type,
MediaType.OCTET_STREAM
if it fails
-
-