|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.millstone.base.service.FileTypeResolver
Utility class that can figure out mime-types and icons related to files. Note that 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 java.lang.String |
DEFAULT_MIME_TYPE
Default mime-type. |
Constructor Summary | |
FileTypeResolver()
|
Method Summary | |
static void |
addExtension(java.lang.String extension,
java.lang.String MIMEType)
Adds a mime-type mapping for the given filename extension. |
static void |
addIcon(java.lang.String MIMEType,
Resource icon)
Adds a icon for the given mime-type. |
static java.util.Map |
getExtensionToMIMETypeMapping()
Gets the internal file extension to mime-type mapping. |
static Resource |
getIcon(java.io.File file)
Gets the descriptive icon representing a file. |
static Resource |
getIcon(java.lang.String fileName)
Gets the descriptive icon representing file, based on the filename. |
static java.lang.String |
getMIMEType(java.io.File file)
Gets the mime-type for a file. |
static java.lang.String |
getMIMEType(java.lang.String fileName)
Gets the mime-type of a file. |
static java.util.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 java.lang.String DEFAULT_MIME_TYPE
Constructor Detail |
public FileTypeResolver()
Method Detail |
public static java.lang.String getMIMEType(java.lang.String fileName)
fileName
- name of the file whose mime-type is requested
String
for the given filenamepublic static Resource getIcon(java.lang.String fileName)
fileName
- name of the file whose icon is requested
public static Resource getIcon(java.io.File file)
file
- the file whose icon is requested
public static java.lang.String getMIMEType(java.io.File file)
file
- the file whose mime-type is requested
String
public static void addExtension(java.lang.String extension, java.lang.String MIMEType)
extension
- the filename extension to be associated with
MIMEType
MIMEType
- the new mime-type for extension
public static void addIcon(java.lang.String MIMEType, Resource icon)
MIMEType
- the mime-type whose icon is to be changedicon
- the new icon to be associated with MIMEType
public static java.util.Map getExtensionToMIMETypeMapping()
public static java.util.Map getMIMETypeToIconMapping()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |