Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

Class javax.activation.FileTypeMap

java.lang.Object
    |
    +----javax.activation.FileTypeMap
Subclasses:
MimetypesFileTypeMap

public abstract class FileTypeMap
extends java.lang.Object
The FileTypeMap is an abstract class that provides a data typing interface based on a file. Implementations of this class will implement the getContentType methods which will derive a content type from a filename or a file object. FileTypeMaps could use any scheme to determine the data type from examining the file extension of a file (like the MimetypesFileTypeMap) to opening the file and trying to derive its type from the contents of the file. The FileDataSource class uses the MimetypesFileTypeMap (and implementation of FileTypeMap) to determine the content type of files.

See Also:
FileTypeMap, FileDataSource, MimetypesFileTypeMap

Constructor Summary
 FileTypeMap()
The default constructor.
 

Method Summary
java.lang.String  getContentType(java.io.File file)
Return the type of the file object.
java.lang.String  getContentType(java.lang.String filename)
Return the type of the file passed inThis method should always return a valid MIME type.
static FileTypeMap  getDefaultFileTypeMap()
Return the default FileTypeMap for the system.
static void  setDefaultFileTypeMap(FileTypeMap map)
Sets the default FileTypeMap for the system.
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTypeMap

public FileTypeMap()
The default constructor.
Method Detail

getContentType

public abstract java.lang.String getContentType(java.io.File file)
Return the type of the file object. This method should always return a valid MIME type.
Parameters:
f - A file to be typed.
Returns:
The content type.

getContentType

public abstract java.lang.String getContentType(java.lang.String filename)
Return the type of the file passed inThis method should always return a valid MIME type.
Parameters:
filename - the pathname of the file.
Returns:
The content type.

setDefaultFileTypeMap

public static void setDefaultFileTypeMap(FileTypeMap map)
Sets the default FileTypeMap for the system. This instance will be returned to callers of getDefaultFileTypeMap.
Parameters:
map - The FileTypeMap.

getDefaultFileTypeMap

public static FileTypeMap getDefaultFileTypeMap()
Return the default FileTypeMap for the system. If a call to setDefaultFileTypeMap is called, return that instance, otherwise return an instance of MimetypesFileTypeMap.
Returns:
The default FileTypeMap
See Also:
setDefaultFileTypeMap

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS