Methods Summary |
---|
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.
|
public abstract java.lang.String | getContentType(java.lang.String filename)Return the type of the file passed in. This method should
always return a valid MIME type.
|
public static javax.activation.FileTypeMap | getDefaultFileTypeMap()Return the default FileTypeMap for the system.
If setDefaultFileTypeMap was called, return
that instance, otherwise return an instance of
MimetypesFileTypeMap .
// XXX - probably should be synchronized
if (defaultMap == null)
defaultMap = new MimetypesFileTypeMap();
return defaultMap;
|
public static void | setDefaultFileTypeMap(javax.activation.FileTypeMap map)Sets the default FileTypeMap for the system. This instance
will be returned to callers of getDefaultFileTypeMap.
SecurityManager security = System.getSecurityManager();
if (security != null) {
try {
// if it's ok with the SecurityManager, it's ok with me...
security.checkSetFactory();
} catch (SecurityException ex) {
// otherwise, we also allow it if this code and the
// factory come from the same class loader (e.g.,
// the JAF classes were loaded with the applet classes).
if (FileTypeMap.class.getClassLoader() !=
map.getClass().getClassLoader())
throw ex;
}
}
defaultMap = map;
|