java.lang.Object | +--javax.activation.FileTypeMap
The FileTypeMap is an abstract class that provides a data typing interface for files. Implementations of this class will implement the getContentType methods which will derive a content type from a file name 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 default FileTypeMap (a MimetypesFileTypeMap unless changed) to determine the content type of files.
FileTypeMap
,FileDataSource
,MimetypesFileTypeMap
FileTypeMap() The default constructor. |
getContentType(java.io.File file) Return the type of the file object. | |
getContentType(java.lang.String filename) Return the type of the file passed in. | |
getDefaultFileTypeMap() Return the default FileTypeMap for the system. | |
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 |
publicFileTypeMap()
public abstract java.lang.StringgetContentType(java.io.File file)
f
- A file to be typed.public abstract java.lang.StringgetContentType(java.lang.String filename)
filename
- the pathname of the file.public static voidsetDefaultFileTypeMap(FileTypeMap map)
map
- The FileTypeMap.java.lang.SecurityException
- if the caller doesn't have permissionto change the defaultpublic staticFileTypeMapgetDefaultFileTypeMap()
MimetypesFileTypeMap
.setDefaultFileTypeMap(javax.activation.FileTypeMap)