Class DefaultMimeRegistry
- java.lang.Object
-
- org.pentaho.reporting.libraries.repository.DefaultMimeRegistry
-
- All Implemented Interfaces:
Serializable
,MimeRegistry
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
- 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 String
getMimeType(String filename)
Queries the mime-type for a given filename.String
getMimeType(ContentItem item)
Queries the mime-type for a given content-item.String
getSuffix(String mimeType)
Returns the default suffix for files with the given content type.
-
-
-
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.- Specified by:
getMimeType
in interfaceMimeRegistry
- 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.- Specified by:
getSuffix
in interfaceMimeRegistry
- Parameters:
mimeType
- the mime-type for which a suffix is queried.- Returns:
- the suffix, never null.
-
-