Package com.saperion.util
Class MimeUtil
java.lang.Object
com.saperion.util.MimeUtil
This MimiUtil can be used to get a MIME type by filenames in a convenient
way. Use it like this: MimeUtil.getMimeType("myFile.pdf").
- Author:
- sts
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The default MIME type to be used if no MIME type matches. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getFilename
(String path) Deprecated.Will be removed in 8.1.static String
getMimeType
(String filename) Returns the MIME type matching the given filename.static String
getMimeTypeByPath
(String path) Returns the MIME type matching the given path (path/[/path...]/filename).protected static void
Initializes the MimetypesFileTypeMap used by this util.
-
Field Details
-
DEFAULT_MIMETYPE
The default MIME type to be used if no MIME type matches.- See Also:
-
-
Method Details
-
initialize
protected static void initialize()Initializes the MimetypesFileTypeMap used by this util. -
getMimeType
Returns the MIME type matching the given filename.- Parameters:
filename
- The filename to get the MIME type of.- Returns:
- the MIME type or "application/octet-stream" if no matching MIME could be found or the util could not be initialized properly.
-
getMimeTypeByPath
Returns the MIME type matching the given path (path/[/path...]/filename).- Parameters:
path
- The filename to get the MIME type of.- Returns:
- the MIME type or "application/octet-stream" if no matching MIME could be found or the util could not be initialized properly.
-
getFilename
Deprecated.Will be removed in 8.1. UseMultipageDocUtil.getFilename(String)
instead.Extracts and returns the filename of the given path. Strips the possible '@' postfix. - Parameters:
path
- The path+filename to be extract the filename from.- Returns:
- The extracted filename.
-