Package jodd.net
Class MimeTypes
java.lang.Object
jodd.net.MimeTypes
Map file extensions to MIME types. Based on the most recent Apache mime.types file.
Duplicated extensions (wmz, sub) are manually resolved.
See also: http://www.iana.org/assignments/media-types/ http://www.webmaster-toolkit.com/mime-types.shtml
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]findExtensionsByMimeTypes(String mimeType, boolean useWildcard) Finds all extensions that belong to given mime type(s).static StringgetMimeType(String ext) Returns the corresponding MIME type to the given extension.static booleanisRegisteredExtension(String extension) Returnstrueif given value is one of the registered MIME extensions.static StringlookupMimeType(String ext) Simply returns MIME type ornullif no type is found.static voidregisterMimeType(String ext, String mimeType) Registers MIME type for provided extension.
-
Field Details
-
MIME_APPLICATION_ATOM_XML
- See Also:
-
MIME_APPLICATION_JAVASCRIPT
- See Also:
-
MIME_APPLICATION_JSON
- See Also:
-
MIME_APPLICATION_OCTET_STREAM
- See Also:
-
MIME_APPLICATION_XML
- See Also:
-
MIME_TEXT_CSS
- See Also:
-
MIME_TEXT_PLAIN
- See Also:
-
MIME_TEXT_HTML
- See Also:
-
MIME_TYPE_MAP
-
-
Constructor Details
-
MimeTypes
public MimeTypes()
-
-
Method Details
-
registerMimeType
Registers MIME type for provided extension. Existing extension type will be overridden. -
getMimeType
Returns the corresponding MIME type to the given extension. If no MIME type was found it returnsapplication/octet-streamtype. -
lookupMimeType
Simply returns MIME type ornullif no type is found. -
findExtensionsByMimeTypes
Finds all extensions that belong to given mime type(s). If wildcard mode is on, provided mime type is wildcard pattern.- Parameters:
mimeType- list of mime types, separated by commauseWildcard- if set, mime types are wildcard patterns
-
isRegisteredExtension
Returnstrueif given value is one of the registered MIME extensions.
-