Package ddf.mime
Interface MimeTypeMapper
public interface MimeTypeMapper
Interface defining a mapper that accesses
MimeTypeResolvers to retieve file extension for
a given mime type, and vice versa.- Author:
- Hugh Rodgers
-
Method Summary
Modifier and TypeMethodDescriptiongetFileExtensionForMimeType(String contentType) Retrieves the file extension for the specified mime type, e.g., returns ".nitf" for a mime type of "image/nitf".getMimeTypeForFileExtension(String fileExtension) Retrieves the mime type for the specified file extension, e.g., returns "image/nitf" for a file extension of "nitf".guessMimeType(InputStream is, String fileExtension) Attempts to guess the mime type for the specified file extension by introspecting the supplied InputStream if necessary.
-
Method Details
-
getFileExtensionForMimeType
Retrieves the file extension for the specified mime type, e.g., returns ".nitf" for a mime type of "image/nitf".- Parameters:
contentType- the mime type- Returns:
- the file extension mapped to the specified mime type
-
getMimeTypeForFileExtension
Retrieves the mime type for the specified file extension, e.g., returns "image/nitf" for a file extension of "nitf".- Parameters:
fileExtension- the file extension to look up the mime type for- Returns:
- the mime type mapped to the specified file extension
-
guessMimeType
Attempts to guess the mime type for the specified file extension by introspecting the supplied InputStream if necessary.- Parameters:
is- InputStream for the @File associated with the file extensionfileExtension- the file extension to look up the mime type for- Returns:
- the mime type mapped for the specified file extension; returns null if it cannot determine the mime type
- Throws:
MimeTypeResolutionException- if any problems encountered during mime type mapping
-