com.ibm.portal.resolver.data
Class FileTypeMap

java.lang.Object
  extended by javax.activation.FileTypeMap
      extended by com.ibm.portal.resolver.data.FileTypeMap

public abstract class FileTypeMap
extends javax.activation.FileTypeMap

Extension to the standard file type map that determines the mime type based on the content

Since:
6.1.0.3

Constructor Summary
FileTypeMap()
           
 
Method Summary
abstract  java.lang.String canonicalize(java.lang.String contentType)
          Canonicalizes the given content type by finding the official IANA mime type for mime type aliases.
abstract  java.lang.String getContentType(byte[] data)
          Tries to determine the content type from the data array.
abstract  java.lang.String getContentType(byte[] data, int off, int len)
          Tries to determine the content type from the data array.
abstract  java.lang.String getExtension(java.lang.String contentType)
          Returns the file extension for the given content type
 
Methods inherited from class javax.activation.FileTypeMap
getContentType, getContentType, getDefaultFileTypeMap, setDefaultFileTypeMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTypeMap

public FileTypeMap()
Method Detail

getExtension

public abstract java.lang.String getExtension(java.lang.String contentType)
Returns the file extension for the given content type

Parameters:
contentType - the content type
Returns:
the file extension
Since:
8.0.0.1

canonicalize

public abstract java.lang.String canonicalize(java.lang.String contentType)
Canonicalizes the given content type by finding the official IANA mime type for mime type aliases. The content type application/x-zip-compressed would e.g. be mapped to the official content type application/zip. If no alias can be found the method returns the input.

Parameters:
contentType - the content type that it potentially an alias, not null
Returns:
the canonicalized content type, not null

getContentType

public abstract java.lang.String getContentType(byte[] data)
Tries to determine the content type from the data array. Returns application/octet-stream as a fallback.

Parameters:
data - the data array, not null
Returns:
the content type, not null

getContentType

public abstract java.lang.String getContentType(byte[] data,
                                                int off,
                                                int len)
Tries to determine the content type from the data array. Returns application/octet-stream as a fallback.

Parameters:
data - the data array, not null
off - index to the first valid byte in the buffer
len - length of the data sequence
Returns:
the content type, not null