public interface MimeTypeService
MimeTypeServicedefines the service applications can call to resolve file names to MIME types and derive default file name extensions from MIME types.
This interface is not intended to be implemented by bundles. It is implemented by this bundle and may be used by client bundles.
|Modifier and Type||Method and Description|
Returns the primary name extension to which the given
Returns the MIME type of the extension of the given
Register MIME types stored in the given input stream formatted as a regular MIME type file format: One entry per line.
Dynamically register a new mime type with one or more file name extensions.
name. The extension is the part of the name after the last dot. If the name does not contain a dot, the name as a whole is assumed to be the extension.
name- The name for which the MIME type is to be returned.
mimeTypemaps. The returned extension must map to the given
mimeTypewhen fed to the
getMimeType(String)method. In other words, the expression
mimeType.equals(getMimeType(getExtension(mimeType)))must always be
truefor any non-
A MIME type may be mapped to multiple extensions (e.g.
log, ...). This
method is expected to returned one of those extensions. It is up to the
implementation to select an appropriate extension if multiple mappings
exist for a single MIME type.
mimeType- The MIME type whose primary extension is requested.
nullif no such mapping exists.
This registration is dynamic and not persisted.
mimeType- The MIME type to register
extensions- One or more file name extensions (without leading dot) to register for the MIME type.
void registerMimeType(InputStream mimeTabStream) throws IOException
#) are ignored.
The stream is assumed to contain string data encoded with "ISO-8859-1".
This method reads the stream until an
IOException occurs or
until it has been fully read. The stream is not closed, though, by this
mimeTabStream- The stream to read the MIME type mappings from
IOException- If an error occurs reading from the stream
Copyright © 2017 The Apache Software Foundation. All rights reserved.