| java.lang.Object org.apache.turbine.services.mimetype.TurbineMimeTypes
TurbineMimeTypes | abstract public class TurbineMimeTypes (Code) | | This is a static accessor to MIME types and charsets.
author: Ilkka Priha version: $Id: TurbineMimeTypes.java 534527 2007-05-02 16:10:59Z tv $ |
Method Summary | |
public static String | getCharSet(Locale locale) Gets the charset for a locale. | public static String | getCharSet(Locale locale, String variant) Gets the charset for a locale with a variant. | public static String | getCharSet(String key) Gets the charset for a specified key.
Parameters: key - the key for the charset. | public static String | getCharSet(String key, String def) Gets the charset for a specified key.
Parameters: key - the key for the charset. Parameters: def - the default charset if none is found. | public static String | getContentType(File file) Gets the MIME content type for a file as a string.
Parameters: file - the file. | public static String | getContentType(String name) Gets the MIME content type for a named file as a string.
Parameters: name - the name of the file. | public static String | getContentType(String ext, String def) Gets the MIME content type for a file name extension as a string.
Parameters: ext - the file name extension. Parameters: def - the default type if none is found. | public static String | getDefaultExtension(MimeType mime) Gets the default file name extension for a MIME type.
Note that the mappers are called in the reverse order.
Parameters: mime - the MIME type. | public static MimeType | getMimeContentType(File file) Gets the MIME content type for a file.
Parameters: file - the file. | public static MimeType | getMimeContentType(String name) Gets the MIME content type for a named file.
Parameters: name - the name of the file. | public static MimeType | getMimeContentType(String ext, String def) Gets the MIME content type for a file name extension.
Parameters: ext - the file name extension. Parameters: def - the default type if none is found. | protected static MimeTypeService | getService() Gets the MIME type service implementation. |
getCharSet | public static String getCharSet(Locale locale)(Code) | | Gets the charset for a locale. First a locale specific charset
is searched for, then a country specific one and lastly a language
specific one. If none is found, the default charset is returned.
Parameters: locale - the locale. the charset. |
getCharSet | public static String getCharSet(Locale locale, String variant)(Code) | | Gets the charset for a locale with a variant. The search
is performed in the following order:
"lang"_"country"_"variant"="charset",
_"counry"_"variant"="charset",
"lang"__"variant"="charset",
__"variant"="charset",
"lang"_"country"="charset",
_"country"="charset",
"lang"="charset".
If nothing of the above is found, the default charset is returned.
Parameters: locale - the locale. Parameters: variant - a variant field. the charset. |
getCharSet | public static String getCharSet(String key)(Code) | | Gets the charset for a specified key.
Parameters: key - the key for the charset. the found charset or the default one. |
getCharSet | public static String getCharSet(String key, String def)(Code) | | Gets the charset for a specified key.
Parameters: key - the key for the charset. Parameters: def - the default charset if none is found. the found charset or the given default. |
getContentType | public static String getContentType(File file)(Code) | | Gets the MIME content type for a file as a string.
Parameters: file - the file. the MIME type string. |
getContentType | public static String getContentType(String name)(Code) | | Gets the MIME content type for a named file as a string.
Parameters: name - the name of the file. the MIME type string. |
getContentType | public static String getContentType(String ext, String def)(Code) | | Gets the MIME content type for a file name extension as a string.
Parameters: ext - the file name extension. Parameters: def - the default type if none is found. the MIME type string. |
getDefaultExtension | public static String getDefaultExtension(MimeType mime)(Code) | | Gets the default file name extension for a MIME type.
Note that the mappers are called in the reverse order.
Parameters: mime - the MIME type. the file name extension or null. |
getMimeContentType | public static MimeType getMimeContentType(File file)(Code) | | Gets the MIME content type for a file.
Parameters: file - the file. the MIME type. |
getMimeContentType | public static MimeType getMimeContentType(String name)(Code) | | Gets the MIME content type for a named file.
Parameters: name - the name of the file. the MIME type. |
getMimeContentType | public static MimeType getMimeContentType(String ext, String def)(Code) | | Gets the MIME content type for a file name extension.
Parameters: ext - the file name extension. Parameters: def - the default type if none is found. the MIME type. |
getService | protected static MimeTypeService getService()(Code) | | Gets the MIME type service implementation.
the MIME type service implementation. |
|
|