Package io.jmix.core
Class FileTypesHelper
java.lang.Object
io.jmix.core.FileTypesHelper
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addExtension
(String extension, String MIMEType) Adds a mime-type mapping for the given filename extension.static Map
Gets the internal file extension to mime-type mapping.static String
getMIMEType
(File file) Gets the mime-type for a file.static String
getMIMEType
(String fileName) Gets the mime-type of a file.
-
Field Details
-
DEFAULT_MIME_TYPE
Default mime-type.- See Also:
-
-
Constructor Details
-
FileTypesHelper
public FileTypesHelper()
-
-
Method Details
-
getMIMEType
Gets the mime-type of a file. Currently the mime-type is resolved based only on the file name extension.- Parameters:
fileName
- the name of the file whose mime-type is requested.- Returns:
- mime-type
String
for the given filename
-
getMIMEType
Gets the mime-type for a file. Currently the returned file type is resolved by the filename extension only.- Parameters:
file
- the file whose mime-type is requested.- Returns:
- the files mime-type
String
-
addExtension
Adds a mime-type mapping for the given filename extension. If the extension is already in the internal mapping it is overwritten.- Parameters:
extension
- the filename extension to be associated withMIMEType
.MIMEType
- the new mime-type forextension
.
-
getExtensionToMIMETypeMapping
Gets the internal file extension to mime-type mapping.- Returns:
- unmodifiable map containing the current file extension to mime-type mapping
-