Package ddf.mime
Interface MimeTypeResolver
public interface MimeTypeResolver
Interface defining an OSGi service that can map a list of file extensions to their corresponding
mime types, and vice versa.
- Author:
- Hugh Rodgers
-
Method Summary
Modifier and TypeMethodDescriptiongetFileExtensionForMimeType(String contentType) Gets the file extension for the specific mime type.getMimeTypeForFileExtension(String fileExtension) Gets the mime type for the specified file extension.getName()Gets the name of the MimeTypeResolver.intGets the priority of the MimeTypeResolver.Gets the schema (if one exists) of the MimeTypeResolver.booleanReturns true if the MimeTypeResolver has a schema, meaning it is for text/xml mime types and has a namespace to match on.
-
Method Details
-
getName
String getName()Gets the name of the MimeTypeResolver.- Returns:
- the name of the MimeTypeResolver
-
getSchema
String getSchema()Gets the schema (if one exists) of the MimeTypeResolver. The schema is set only for xml mime types, e.g., text/xml, and reflects the namespace of the root element.- Returns:
- the name of the MimeTypeResolver
-
hasSchema
boolean hasSchema()Returns true if the MimeTypeResolver has a schema, meaning it is for text/xml mime types and has a namespace to match on.- Returns:
- true if the MimeTypeResolver has a schema
-
getPriority
int getPriority()Gets the priority of the MimeTypeResolver. The higher the number the higher the priority, meaning the MimeTypeResolver is invoked earlier.- Returns:
- the priority of the MimeTypeResolver
-
getFileExtensionForMimeType
Gets the file extension for the specific mime type. For example, if the mime type is image/nitf a file extension of .nitf would be returned. The mapping of file extensions to mime types is part of the configuration of a MimeTypeResolver.- Parameters:
contentType- the mime type- Returns:
- the file extension, including the period in the extension
-
getMimeTypeForFileExtension
Gets the mime type for the specified file extension.- Parameters:
fileExtension- the file extension without the period in it- Returns:
- the mime type
-