Class DefaultMimeRegistry

  • All Implemented Interfaces:
    java.io.Serializable, MimeRegistry

    public class DefaultMimeRegistry
    extends java.lang.Object
    implements MimeRegistry, java.io.Serializable
    The default-mime registry contains a list of well-known file types and returns mime-information for them. This implementation recognizes a couple of image types and CSS, XML and HTML files. The content is recognized by its filename, not by its actual content.
    Author:
    Thomas Morgner
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultMimeRegistry()
      Default Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getMimeType​(java.lang.String filename)
      Queries the mime-type for a given filename.
      java.lang.String getMimeType​(ContentItem item)
      Queries the mime-type for a given content-item.
      java.lang.String getSuffix​(java.lang.String mimeType)
      Returns the default suffix for files with the given content type.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultMimeRegistry

        public DefaultMimeRegistry()
        Default Constructor.
    • Method Detail

      • getMimeType

        public java.lang.String getMimeType​(ContentItem item)
        Queries the mime-type for a given content-item. Some repositories store mime-type information along with the content data, while others might resort to heuristics based on the filename or actual data stored in the item.
        Specified by:
        getMimeType in interface MimeRegistry
        Parameters:
        item - the content item for which Mime-Data should be queried.
        Returns:
        the mime-type never null.
      • getMimeType

        public java.lang.String getMimeType​(java.lang.String filename)
        Queries the mime-type for a given filename. Some repositories store mime-type information along with the content data, while others might resort to heuristics based on the filename or actual data stored in the item.
        Parameters:
        filename - the content item for which Mime-Data should be queried.
        Returns:
        the mime-type never null.
      • getSuffix

        public java.lang.String getSuffix​(java.lang.String mimeType)
        Returns the default suffix for files with the given content type.
        Specified by:
        getSuffix in interface MimeRegistry
        Parameters:
        mimeType - the mime-type for which a suffix is queried.
        Returns:
        the suffix, never null.