SMILA (incubation) API documentation

org.eclipse.smila.common.mimetype.impl
Class SimpleMimeTypeIdentifier

java.lang.Object
  extended by org.eclipse.smila.common.mimetype.impl.SimpleMimeTypeIdentifier
All Implemented Interfaces:
MimeTypeIdentifier

public class SimpleMimeTypeIdentifier
extends java.lang.Object
implements MimeTypeIdentifier

The simple MIME type identifier is able to detect MIME types based on a static extension mapping.

Author:
August Georg Schmidt (BROX), Daniel Stucky

Constructor Summary
SimpleMimeTypeIdentifier()
           
 
Method Summary
 java.lang.String identify(byte[] data)
          Identifies a MimeType based an the given data.
 java.lang.String identify(byte[] data, java.lang.String extension)
          Identifies a MimeType based an the given data and file extension.
 java.lang.String identify(java.lang.String extension)
          Identifies a MimeType based an the file extension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMimeTypeIdentifier

public SimpleMimeTypeIdentifier()
Method Detail

identify

public java.lang.String identify(byte[] data)
                          throws MimeTypeParseException
Identifies a MimeType based an the given data.

Specified by:
identify in interface MimeTypeIdentifier
Parameters:
data - a byte[] containing the data
Returns:
the detected MimeType
Throws:
MimeTypeParseException - if any error occurs
See Also:
MimeTypeIdentifier.identify(byte[])

identify

public java.lang.String identify(java.lang.String extension)
                          throws MimeTypeParseException
Identifies a MimeType based an the file extension.

Specified by:
identify in interface MimeTypeIdentifier
Parameters:
extension - the extension of the filename
Returns:
the detected MimeType
Throws:
MimeTypeParseException - if any error occurs
See Also:
MimeTypeIdentifier.identify(java.lang.String)

identify

public java.lang.String identify(byte[] data,
                                 java.lang.String extension)
                          throws MimeTypeParseException
Identifies a MimeType based an the given data and file extension.

Specified by:
identify in interface MimeTypeIdentifier
Parameters:
data - a byte[] containing the data
extension - the extension of the filename
Returns:
the detected MimeType
Throws:
MimeTypeParseException - if any error occurs
See Also:
org.eclipse.smila.processing.common.MimeTypeIdentifier#identify(org.eclipse.smila.datamodel.id.Id, byte[], java.lang.String)

SMILA (incubation) API documentation