Class MimeTypes
java.lang.Object
org.apache.flink.runtime.rest.handler.util.MimeTypes
Simple utility class that resolves file extensions to MIME types.
There are various solutions built into Java that depend on extra resource and configuration files. They are designed to be composable and extensible, but also unfortunately tricky to control. This is meant to be a simple solution that may eventually be subsumed by a better one.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringGets the default MIME type, which is"application/octet-stream".static StringgetMimeTypeForExtension(String fileExtension) Gets the MIME type for the file with the given extension.static StringgetMimeTypeForFileName(String fileName) Gets the MIME type for the file with the given name, by extension.
-
Method Details
-
getMimeTypeForExtension
Gets the MIME type for the file with the given extension. If the mime type is not recognized, this method returns null.- Parameters:
fileExtension- The file extension.- Returns:
- The MIME type, or
null, if the file extension is not recognized.
-
getMimeTypeForFileName
Gets the MIME type for the file with the given name, by extension. This method tries to extract the file extension and then use thegetMimeTypeForExtension(String)to determine the MIME type. If the extension cannot be determined, or the extension is unrecognized, this method returnnull.- Parameters:
fileName- The file name.- Returns:
- The MIME type, or
null, if the file's extension is not recognized.
-
getDefaultMimeType
Gets the default MIME type, which is"application/octet-stream".- Returns:
- The default MIME type.
-