|
Java™ Platform Standard Ed. 6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.activation.FileTypeMap
public abstract class 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
Constructor Summary | |
---|---|
FileTypeMap()
The default constructor. |
Method Summary | |
---|---|
abstract String |
getContentType(File file)
Return the type of the file object. |
abstract String |
getContentType(String filename)
Return the type of the file passed in. |
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 |
---|
public FileTypeMap()
Method Detail |
---|
public abstract String getContentType(File file)
file
- A file to be typed.
public abstract String getContentType(String filename)
filename
- the pathname of the file.
public static void setDefaultFileTypeMap(FileTypeMap map)
map
- The FileTypeMap.
SecurityException
- if the caller doesn't have permission
to change the defaultpublic static FileTypeMap getDefaultFileTypeMap()
MimetypesFileTypeMap
.
setDefaultFileTypeMap(javax.activation.FileTypeMap)
|
Java™ Platform Standard Ed. 6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.