|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.activation.FileTypeMap javax.activation.MimetypesFileTypeMap
public class MimetypesFileTypeMap
This class extends FileTypeMap and provides data typing of files
via their file extension. It uses the .mime.types
format.
MIME types file search order:
The MimetypesFileTypeMap looks in various places in the user's system for MIME types file entries. When requests are made to search for MIME types in the MimetypesFileTypeMap, it searches MIME types files in the following order:
.mime.types
in the user's home directory.
/lib/mime.types
.
META-INF/mime.types
.
META-INF/mimetypes.default
(usually found only in the activation.jar
file).
MIME types file format:
# comments begin with a '#'
# the format is <mime type> <space separated file extensions>
# for example:
text/plain txt text TXT
# this would map file.txt, file.text, and file.TXT to
# the mime type "text/plain"
Constructor Summary | |
---|---|
MimetypesFileTypeMap()
The default constructor. |
|
MimetypesFileTypeMap(java.io.InputStream is)
Construct a MimetypesFileTypeMap with programmatic entries added from the InputStream. |
|
MimetypesFileTypeMap(java.lang.String mimeTypeFileName)
Construct a MimetypesFileTypeMap with programmatic entries added from the named file. |
Method Summary | |
---|---|
void |
addMimeTypes(java.lang.String mime_types)
Prepend the MIME type values to the registry. |
java.lang.String |
getContentType(java.io.File f)
Return the MIME type of the file object. |
java.lang.String |
getContentType(java.lang.String filename)
Return the MIME type based on the specified file name. |
Methods inherited from class javax.activation.FileTypeMap |
---|
getDefaultFileTypeMap, setDefaultFileTypeMap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MimetypesFileTypeMap()
public MimetypesFileTypeMap(java.lang.String mimeTypeFileName) throws java.io.IOException
mimeTypeFileName
- the file name
java.io.IOException
public MimetypesFileTypeMap(java.io.InputStream is)
is
- the input stream to read fromMethod Detail |
---|
public void addMimeTypes(java.lang.String mime_types)
mime_types
- A .mime.types formatted string of entries.public java.lang.String getContentType(java.io.File f)
getContentType(f.getName())
.
getContentType
in class FileTypeMap
f
- the file
public java.lang.String getContentType(java.lang.String filename)
getContentType
in class FileTypeMap
filename
- the file name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2009, 2010, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.
Generated on 4-June-2010 04:34