|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.service.FileTypeResolver
public class FileTypeResolver
Utility class that can figure out mime-types and icons related to files.
Note : The icons are associated purely to mime-types, so a file may not have a custom icon accessible with this class.
Field Summary | |
---|---|
static Resource |
DEFAULT_ICON
Default icon given if no icon is specified for a mime-type. |
static String |
DEFAULT_MIME_TYPE
Default mime-type. |
Constructor Summary | |
---|---|
FileTypeResolver()
|
Method Summary | |
---|---|
static void |
addExtension(String extension,
String MIMEType)
Adds a mime-type mapping for the given filename extension. |
static void |
addIcon(String MIMEType,
Resource icon)
Adds a icon for the given mime-type. |
static Map |
getExtensionToMIMETypeMapping()
Gets the internal file extension to mime-type mapping. |
static Resource |
getIcon(File file)
Gets the descriptive icon representing a file. |
static Resource |
getIcon(String fileName)
Gets the descriptive icon representing file, based on the filename. |
static String |
getMIMEType(File file)
Gets the mime-type for a file. |
static String |
getMIMEType(String fileName)
Gets the mime-type of a file. |
static Map |
getMIMETypeToIconMapping()
Gets the internal mime-type to icon mapping. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static Resource DEFAULT_ICON
public static String DEFAULT_MIME_TYPE
Constructor Detail |
---|
public FileTypeResolver()
Method Detail |
---|
public static String getMIMEType(String fileName)
fileName
- the name of the file whose mime-type is requested.
String
for the given filenamepublic static Resource getIcon(String fileName)
fileName
- the name of the file whose icon is requested.
public static Resource getIcon(File file)
file
- the file whose icon is requested.
public static String getMIMEType(File file)
file
- the file whose mime-type is requested.
String
public static void addExtension(String extension, String MIMEType)
extension
- the filename extension to be associated with
MIMEType
.MIMEType
- the new mime-type for extension
.public static void addIcon(String MIMEType, Resource icon)
MIMEType
- the mime-type whose icon is to be changed.icon
- the new icon to be associated with MIMEType
.public static Map getExtensionToMIMETypeMapping()
public static Map getMIMETypeToIconMapping()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |