|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.activation.CommandMap | +--javax.activation.MailcapCommandMap
a comand map that represents the mailcap file. The mailcap file format is specified in RFC1524. Within the JAF it is used as an easy way to specify beans that perform certain operations on data of a particular MIME content type.
For example, the following mailcap file specifies 2 beans that
perform different operations on the text/html
MIME type and a bean that displays JPEG images:
text/html; ; x-java-edit=gnu.inet.mime.html.HTMLBrowser text/&asterisk; ; \ x-java-print=gnu.inet.mime.xml.DocPrinter image/jpeg; jpegviewercprog %s \ ; x-java-view=gnu.inet.mime.JPEGViewer
This class provides a way to access the registry of information that is declared in such a mailcap file.
mailcap commands that do not begin with x-java-
are ignored. The special command: x-java-content-handler
causes this class to intepret the command as a
DataContentHandler
. There is a special method for
obtaining the content handler for a particular MIME type. Other
methods provide various ways of accessing the command registry
for a particular MIME type.
Constructor Summary | |
MailcapCommandMap()
create default MIME Types registry. |
|
MailcapCommandMap(java.io.InputStream stream)
create mailcap command map with entries from stream. |
|
MailcapCommandMap(java.lang.String fileName)
create mailcap command map with entries from file. |
Method Summary | |
void |
addMailcap(java.lang.String mailCapEntry)
programmically add a mailcap entry. |
DataContentHandler |
createDataContentHandler(java.lang.String mimeType)
create a content handler for the specified MIME type. |
CommandInfo[] |
getAllCommands(java.lang.String mimeType)
get the list of all commands based on MIME type. |
CommandInfo |
getCommand(java.lang.String mimeType,
java.lang.String cmdName)
get command info for the specified MIME type and command name. |
CommandInfo[] |
getPreferredCommands(java.lang.String mimeType)
get list of preferred commands based on MIME type. |
static void |
main(java.lang.String[] argv)
With an argument of a content-type lists the preferred commands. |
Methods inherited from class javax.activation.CommandMap |
getDefaultCommandMap, setDefaultCommandMap |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MailcapCommandMap()
public MailcapCommandMap(java.lang.String fileName) throws java.io.IOException
fileName
- Name of file to readjava.io.IOException
- IO exception occurredpublic MailcapCommandMap(java.io.InputStream stream)
stream
- Input stream of mailcap formatted entriesMethod Detail |
public void addMailcap(java.lang.String mailCapEntry)
mailCapEntry
- Mailcap formatted entrypublic DataContentHandler createDataContentHandler(java.lang.String mimeType)
content-handler
)
is returned.createDataContentHandler
in class CommandMap
mimeType
- the MIME type to find a content handler forpublic CommandInfo[] getAllCommands(java.lang.String mimeType)
text/html
matches against:
getAllCommands
in class CommandMap
mimeType
- MIME type to search forpublic CommandInfo getCommand(java.lang.String mimeType, java.lang.String cmdName)
getCommand
in class CommandMap
mimeType
- MIME type to search forcmdName
- Command name to checkpublic CommandInfo[] getPreferredCommands(java.lang.String mimeType)
getPreferredCommands
in class CommandMap
mimeType
- MIME type to search forpublic static void main(java.lang.String[] argv)
argv
- Command-lline arguments
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |