org.pentaho.reporting.libraries.repository

Class DefaultMimeRegistry

public class DefaultMimeRegistry extends Object implements MimeRegistry, 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

Constructor Summary
DefaultMimeRegistry()
Default Constructor.
Method Summary
StringgetMimeType(ContentItem item)
Queries the mime-type for a given content-item.
StringgetMimeType(String filename)
Queries the mime-type for a given filename.
StringgetSuffix(String mimeType)
Returns the default suffix for files with the given content type.

Constructor Detail

DefaultMimeRegistry

public DefaultMimeRegistry()
Default Constructor.

Method Detail

getMimeType

public 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.

Parameters: item the content item for which Mime-Data should be queried.

Returns: the mime-type never null.

getMimeType

public String getMimeType(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 String getSuffix(String mimeType)
Returns the default suffix for files with the given content type.

Parameters: mimeType the mime-type for which a suffix is queried.

Returns: the suffix, never null.