|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.activation.FileTypeMap | +--javax.activation.MimetypesFileTypeMap
MimetypesFileTypeMap is the default data typing engine of files for
the activation framework. The engine maps filename extensions to
data types using the mime.type file format. The registry is
constructed from a number of mime.type
files from
various locations, as well as, programmically from data streams
and API calls.
The following files make up the default MIME Type registry:
main
method so it's possible to test some
of the funtionality. Supply a content type on the command line to find
all the matching extensions in the (automatically constructed) database.
Constructor Summary | |
MimetypesFileTypeMap()
Create a default MIME Types registry. |
|
MimetypesFileTypeMap(java.io.InputStream stream)
Create a MIME Types registry with further entries loaded from the specified input stream. |
|
MimetypesFileTypeMap(java.lang.String filename)
Create a MIME Types registry with further entries loaded from the specified file |
Method Summary | |
void |
addMimeTypes(java.lang.String mimeTypes)
Add MIME Type entries to the programmic registry. |
java.lang.String |
getContentType(java.io.File file)
Get the content type of the specified file. |
java.lang.String |
getContentType(java.lang.String filename)
Get the content type of the specified file. |
static void |
main(java.lang.String[] argv)
Takes a content type and finds all the extensions associated with it. |
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.io.InputStream stream)
stream
- MIME Types formatted data streampublic MimetypesFileTypeMap(java.lang.String filename) throws java.io.IOException
mimeTypeFileName
- MIME Types formatted filejava.io.IOException
- IO problem occurred loading the fileMethod Detail |
public java.lang.String getContentType(java.io.File file)
getContentType
in class FileTypeMap
file
- File to checkwhich is called with the file's name
public java.lang.String getContentType(java.lang.String filename)
getContentType
in class FileTypeMap
filename
- name to checkpublic void addMimeTypes(java.lang.String mimeTypes)
mimeTypes
- MIME Types formatted entrypublic static void main(java.lang.String[] argv)
argv
- Command-line arguments
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |