public class MailcapFile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static boolean |
addReverse |
private java.util.Map |
fallback_hash
Another Map like above, but for fallback entries.
|
private java.util.Map |
native_commands
A Map indexed by MIME type (string) that references
a List of native commands (string) corresponding to the type.
|
private java.util.Map |
type_hash
A Map indexed by MIME type (string) that references
a Map of commands for each type.
|
Constructor and Description |
---|
MailcapFile()
Mailcap file default constructor.
|
MailcapFile(java.io.InputStream is)
The constructor that takes an input stream as an argument.
|
MailcapFile(java.lang.String new_fname)
The constructor that takes a filename as an argument.
|
Modifier and Type | Method and Description |
---|---|
void |
appendToMailcap(java.lang.String mail_cap)
appendToMailcap: Append to this Mailcap DB, use the mailcap
format:
Comment == "# comment string"
Entry == "mimetype; javabeanclass"
Example:
# this is a comment
image/gif jaf.viewers.ImageViewer
|
java.util.Map |
getMailcapFallbackList(java.lang.String mime_type)
Get the Map of fallback MailcapEntries based on the MIME type.
|
java.util.Map |
getMailcapList(java.lang.String mime_type)
Get the Map of MailcapEntries based on the MIME type.
|
java.lang.String[] |
getMimeTypes()
Return all the MIME types known to this mailcap file.
|
java.lang.String[] |
getNativeCommands(java.lang.String mime_type)
Return all the native comands for the given MIME type.
|
private java.util.Map |
mergeResults(java.util.Map first,
java.util.Map second)
Merge the first hash into the second.
|
private void |
parse(java.io.Reader reader)
parse file into a hash table of MC Type Entry Obj
|
protected void |
parseLine(java.lang.String mailcapEntry)
A routine to parse individual entries in a Mailcap file.
|
protected static void |
reportParseError(int expectedToken,
int otherExpectedToken,
int anotherExpectedToken,
int actualToken,
java.lang.String actualTokenValue) |
protected static void |
reportParseError(int expectedToken,
int otherExpectedToken,
int actualToken,
java.lang.String actualTokenValue) |
protected static void |
reportParseError(int expectedToken,
int actualToken,
java.lang.String actualTokenValue) |
private java.util.Map type_hash
private java.util.Map fallback_hash
private java.util.Map native_commands
private static boolean addReverse
public MailcapFile(java.lang.String new_fname) throws java.io.IOException
new_fname
- The file name of the mailcap file.java.io.IOException
- for I/O errorspublic MailcapFile(java.io.InputStream is) throws java.io.IOException
is
- the input streamjava.io.IOException
- for I/O errorspublic MailcapFile()
public java.util.Map getMailcapList(java.lang.String mime_type)
Semantics: First check for the literal mime type, if that fails looks for wildcard <type>/\* and return that. Return the list of all that hit.
mime_type
- the MIME typepublic java.util.Map getMailcapFallbackList(java.lang.String mime_type)
Semantics: First check for the literal mime type, if that fails looks for wildcard <type>/\* and return that. Return the list of all that hit.
mime_type
- the MIME typepublic java.lang.String[] getMimeTypes()
public java.lang.String[] getNativeCommands(java.lang.String mime_type)
mime_type
- the MIME typeprivate java.util.Map mergeResults(java.util.Map first, java.util.Map second)
public void appendToMailcap(java.lang.String mail_cap)
mail_cap
- the mailcap stringprivate void parse(java.io.Reader reader) throws java.io.IOException
java.io.IOException
protected void parseLine(java.lang.String mailcapEntry) throws MailcapParseException, java.io.IOException
mailcapEntry
- the mailcap entryMailcapParseException
- for parse errorsjava.io.IOException
- for I/O errorsprotected static void reportParseError(int expectedToken, int actualToken, java.lang.String actualTokenValue) throws MailcapParseException
MailcapParseException
protected static void reportParseError(int expectedToken, int otherExpectedToken, int actualToken, java.lang.String actualTokenValue) throws MailcapParseException
MailcapParseException
protected static void reportParseError(int expectedToken, int otherExpectedToken, int anotherExpectedToken, int actualToken, java.lang.String actualTokenValue) throws MailcapParseException
MailcapParseException