Package com.saperion.util
Class MimeUtil
- java.lang.Object
-
- com.saperion.util.MimeUtil
-
public final class MimeUtil extends java.lang.Object
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
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_MIMETYPE
The default MIME type to be used if no MIME type matches.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.String
getFilename(java.lang.String path)
Deprecated.Will be removed in 8.1.static java.lang.String
getMimeType(java.lang.String filename)
Returns the MIME type matching the given filename.static java.lang.String
getMimeTypeByPath(java.lang.String path)
Returns the MIME type matching the given path (path/[/path...]/filename).protected static void
initialize()
Initializes the MimetypesFileTypeMap used by this util.
-
-
-
Field Detail
-
DEFAULT_MIMETYPE
public static final java.lang.String DEFAULT_MIMETYPE
The default MIME type to be used if no MIME type matches.- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
protected static void initialize()
Initializes the MimetypesFileTypeMap used by this util.
-
getMimeType
public static java.lang.String getMimeType(java.lang.String filename)
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
public static java.lang.String getMimeTypeByPath(java.lang.String path)
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 public static java.lang.String getFilename(java.lang.String path)
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.
-
-