Top Fields Constructors Methods
com.sun.activation.registries

public Class MailcapFile

extends Object
Class Inheritance
Imports
java.io.*, java.util.*

Field Summary

Modifier and TypeField and Description
private static boolean
private Map<K, V>
fallback_hash

Another Map like above, but for fallback entries.

private Map<K, V>
native_commands

A Map indexed by MIME type (string) that references a List of native commands (string) corresponding to the type.

private Map<K, V>
type_hash

A Map indexed by MIME type (string) that references a Map of commands for each type.

Constructor Summary

AccessConstructor and Description
public
MailcapFile(String
The file name of the mailcap file.
new_fname
)

The constructor that takes a filename as an argument.

public
MailcapFile(InputStream
the input stream
is
)

The constructor that takes an input stream as an argument.

public
MailcapFile()

Mailcap file default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
appendToMailcap(String mail_cap)

appendToMailcap: Append to this Mailcap DB, use the mailcap format: Comment == "# comment string Entry == "mimetype; javabeanclass<nl> Example: # this is a comment image/gif jaf.viewers.ImageViewer

public Map<K, V>
getMailcapFallbackList(String mime_type)

Get the Map of fallback MailcapEntries based on the MIME type.

public Map<K, V>
getMailcapList(String mime_type)

Get the Map of MailcapEntries based on the MIME type.

public String[]
getMimeTypes()

Return all the MIME types known to this mailcap file.

public String[]
getNativeCommands(String mime_type)

Return all the native comands for the given MIME type.

private Map<K, V>
mergeResults(Map<K, V> first, Map<K, V> second)

Merge the first hash into the second.

private void
parse(Reader reader)

parse file into a hash table of MC Type Entry Obj

protected void
parseLine(String mailcapEntry)

A routine to parse individual entries in a Mailcap file.

protected static void
reportParseError(int expectedToken, int actualToken, String actualTokenValue)

protected static void
reportParseError(int expectedToken, int otherExpectedToken, int actualToken, String actualTokenValue)

protected static void
reportParseError(int expectedToken, int otherExpectedToken, int anotherExpectedToken, int actualToken, String actualTokenValue)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addReverseback to summary
private static boolean addReverse
fallback_hashback to summary
private Map<K, V> fallback_hash

Another Map like above, but for fallback entries.

native_commandsback to summary
private Map<K, V> native_commands

A Map indexed by MIME type (string) that references a List of native commands (string) corresponding to the type.

type_hashback to summary
private Map<K, V> type_hash

A Map indexed by MIME type (string) that references a Map of commands for each type. The comand Map is indexed by the command name and references a List of class names (strings) for each command.

Constructor Detail

MailcapFileback to summary
public MailcapFile(String new_fname) throws IOException

The constructor that takes a filename as an argument.

Parameters
new_fname:String

The file name of the mailcap file.

MailcapFileback to summary
public MailcapFile(InputStream is) throws IOException

The constructor that takes an input stream as an argument.

Parameters
is:InputStream

the input stream

MailcapFileback to summary
public MailcapFile()

Mailcap file default constructor.

Method Detail

appendToMailcapback to summary
public void appendToMailcap(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

getMailcapFallbackListback to summary
public Map<K, V> getMailcapFallbackList(String mime_type)

Get the Map of fallback MailcapEntries based on the MIME type.

Semantics: First check for the literal mime type, if that fails looks for wildcard /\* and return that. Return the list of all that hit.

getMailcapListback to summary
public Map<K, V> getMailcapList(String mime_type)

Get the Map of MailcapEntries based on the MIME type.

Semantics: First check for the literal mime type, if that fails looks for wildcard /\* and return that. Return the list of all that hit.

getMimeTypesback to summary
public String[] getMimeTypes()

Return all the MIME types known to this mailcap file.

getNativeCommandsback to summary
public String[] getNativeCommands(String mime_type)

Return all the native comands for the given MIME type.

mergeResultsback to summary
private Map<K, V> mergeResults(Map<K, V> first, Map<K, V> second)

Merge the first hash into the second. This merge will only effect the hashtable that is returned, we don't want to touch the one passed in since its integrity must be maintained.

parseback to summary
private void parse(Reader reader) throws IOException

parse file into a hash table of MC Type Entry Obj

parseLineback to summary
protected void parseLine(String mailcapEntry) throws MailcapParseException, IOException

A routine to parse individual entries in a Mailcap file. Note that this routine does not handle line continuations. They should have been handled prior to calling this routine.

reportParseErrorback to summary
protected static void reportParseError(int expectedToken, int actualToken, String actualTokenValue) throws MailcapParseException
reportParseErrorback to summary
protected static void reportParseError(int expectedToken, int otherExpectedToken, int actualToken, String actualTokenValue) throws MailcapParseException
reportParseErrorback to summary
protected static void reportParseError(int expectedToken, int otherExpectedToken, int anotherExpectedToken, int actualToken, String actualTokenValue) throws MailcapParseException