public class FileTypeResolver extends Object
Note : The icons are associated purely to mime-types, so a file may not have a custom icon accessible with this class.
| Modifier and Type | Field and Description |
|---|---|
static Resource |
DEFAULT_ICON
Default icon given if no icon is specified for a mime-type.
|
static String |
DEFAULT_MIME_TYPE
Default mime-type.
|
| Modifier | Constructor and Description |
|---|---|
protected |
FileTypeResolver() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addExtension(String extension,
String mimeType)
Adds a mime-type mapping for the given filename extension.
|
static Map<String,String> |
getExtensionToMIMETypeMapping()
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.
|
public static Resource DEFAULT_ICON
public static String DEFAULT_MIME_TYPE
public static String getMIMEType(String fileName)
fileName - the name of the file whose mime-type is requested.String for the given filenamepublic static String getMIMEType(File file)
file - the file whose mime-type is requested.Stringpublic static void addExtension(String extension, String mimeType)
extension - the filename extension to be associated with
MIMEType.mimeType - the new mime-type for extension.Copyright © 2021 Vaadin Ltd. All rights reserved.