|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ContentTypeMap
ContentTypeMap maintains mappings between MIME types and the corresponding file name extensions, and between locales and character encodings. The mappings are typically defined in properties or files located in user's home directory, Java home directory or the current class jar depending on the implementation.
| Method Summary | |
|---|---|
String |
getCharSet(Locale locale)
Gets the charset for a locale. |
String |
getCharSet(Locale locale,
List accepted)
Gets the accepted charset for a locale. |
String |
getCharSet(Locale locale,
String variant)
Gets the charset for a locale with an optional variant. |
String |
getCharSet(Locale locale,
String variant,
List accepted)
Gets the accepted charset for a locale with an optional variant. |
String |
getCharSet(String path)
Gets the charset for a localized file path. |
String |
getCharSetPath()
Gets the pathname of the charset file. |
String |
getConfigKey()
Gets the path finder key for resolving configuration paths. |
String |
getContentType(File file)
Gets the MIME content type for a file as a string. |
String |
getContentType(String name)
Gets the MIME content type for a named file as a string. |
String |
getContentType(String ext,
String def)
Gets the MIME content type for a file name extension as a string. |
String[] |
getContentTypes(String ext)
Gets the MIME content types for a file name extension. |
String |
getDefaultExtension(MimeType mime)
Gets the default file name extension for a MIME type. |
String |
getDefaultExtension(String type)
Gets the default file name extension for a MIME type. |
String[] |
getExtensions(String type)
Gets the file name extensions for a MIME type. |
MimeType |
getMimeType(File file)
Gets the MIME content type for a file. |
MimeType |
getMimeType(String name)
Gets the MIME type for a named file. |
MimeType |
getMimeType(String ext,
String def)
Gets the MIME type for a file name extension. |
String |
getMimeTypePath()
Gets the pathname of the MIME type file. |
void |
setCharSet(String key,
String charset)
Sets a locale-charset mapping. |
void |
setCharSetPath(String path)
Sets the pathname of the charset file. |
void |
setConfigKey(String key)
Sets the path finder key for resolving configuration paths. |
void |
setContentType(String spec)
Sets a MIME content type mapping to extensions to the map. |
void |
setMimeTypePath(String path)
Sets the pathname of the MIME type file. |
| Method Detail |
|---|
String getConfigKey()
void setConfigKey(String key)
key - the path finder key.void setContentType(String spec)
spec - a MIME type extension specification to add.String getContentType(File file)
file - the file.
String getContentType(String name)
name - the name of the file.
String getContentType(String ext,
String def)
ext - the file name extension.def - the default type if none is found.
String[] getContentTypes(String ext)
ext - the file name extension.
MimeType getMimeType(File file)
file - the file.
MimeType getMimeType(String name)
name - the name of the file.
MimeType getMimeType(String ext,
String def)
ext - the file name extension.def - the default type if none is found.
String getDefaultExtension(String type)
type - the MIME type as a string.
String getDefaultExtension(MimeType mime)
mime - the MIME type.
String[] getExtensions(String type)
type - the MIME type as a string.
String getCharSet(String path)
path - the localized path.
void setCharSet(String key,
String charset)
key - the key for the charset.charset - the corresponding charset.String getCharSet(Locale locale)
locale - the locale.
String getCharSet(Locale locale,
String variant)
locale - the locale.variant - an optional variant.
String getCharSet(Locale locale,
List accepted)
locale - the locale.accepted - a list of accepted charsets.
String getCharSet(Locale locale,
String variant,
List accepted)
The search is performed in the following order:
The found charsets are compared with the list of accepted ones and the first accepted charset is returned. If none of the above is accepted but UTF-8 is, UTF-8 is returned. Otherwise the first found charset is returned.
locale - the locale.variant - the variant.accepted - a list of accepted charsets.
String getMimeTypePath()
void setMimeTypePath(String path)
path - the pathname of the MIME type file.String getCharSetPath()
void setCharSetPath(String path)
path - the pathname of the charset file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||