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 Type
    Method
    Description
    Gets the file extension for the specific mime type.
    Gets the mime type for the specified file extension.
    Gets the name of the MimeTypeResolver.
    int
    Gets the priority of the MimeTypeResolver.
    Gets the schema (if one exists) of the MimeTypeResolver.
    boolean
    Returns 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

      String getFileExtensionForMimeType(String contentType)
      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

      String getMimeTypeForFileExtension(String fileExtension)
      Gets the mime type for the specified file extension.
      Parameters:
      fileExtension - the file extension without the period in it
      Returns:
      the mime type