summaryrefslogtreecommitdiff
path: root/javax/activation/MailcapCommandMap.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/activation/MailcapCommandMap.java')
-rw-r--r--javax/activation/MailcapCommandMap.java69
1 files changed, 34 insertions, 35 deletions
diff --git a/javax/activation/MailcapCommandMap.java b/javax/activation/MailcapCommandMap.java
index cca5f04aa..48b1bbb08 100644
--- a/javax/activation/MailcapCommandMap.java
+++ b/javax/activation/MailcapCommandMap.java
@@ -82,8 +82,8 @@ public class MailcapCommandMap
private static boolean debug = false;
private static final int NORMAL = 0;
private static final int FALLBACK = 1;
-
- static
+
+ static
{
try
{
@@ -94,9 +94,9 @@ public class MailcapCommandMap
{
}
}
-
+
private Map<String,Map<String,List<String>>>[][] mailcaps;
-
+
/**
* Default constructor.
*/
@@ -104,7 +104,7 @@ public class MailcapCommandMap
{
init(null);
}
-
+
/**
* Constructor specifying a filename.
* @param fileName the name of the file to read mailcap entries from
@@ -132,7 +132,7 @@ public class MailcapCommandMap
}
}
}
-
+
/**
* Constructor specifying an input stream.
* @param is the input stream to read mailcap entries from
@@ -150,7 +150,7 @@ public class MailcapCommandMap
for (int j = 0; j < 2; j++)
{
mailcaps[i][j] =
- new LinkedHashMap<String,Map<String,List<String>>>();
+ new LinkedHashMap<String,Map<String,List<String>>>();
}
}
if (in != null)
@@ -167,7 +167,7 @@ public class MailcapCommandMap
{
}
}
-
+
if (debug)
{
System.out.println("MailcapCommandMap: load HOME");
@@ -186,17 +186,17 @@ public class MailcapCommandMap
catch (SecurityException e)
{
}
-
+
if (debug)
{
System.out.println("MailcapCommandMap: load SYS");
}
try
{
- parseFile(SYS,
+ parseFile(SYS,
new CPStringBuilder(System.getProperty("java.home"))
- .append(File.separatorChar)
- .append("lib")
+ .append(File.separatorChar)
+ .append("lib")
.append(File.separatorChar)
.append("mailcap")
.toString());
@@ -204,7 +204,7 @@ public class MailcapCommandMap
catch (SecurityException e)
{
}
-
+
if (debug)
{
System.out.println("MailcapCommandMap: load JAR");
@@ -253,14 +253,14 @@ public class MailcapCommandMap
{
parseResource(JAR, "/META-INF/mailcap");
}
-
+
if (debug)
{
System.out.println("MailcapCommandMap: load DEF");
}
parseResource(DEF, "/META-INF/mailcap.default");
}
-
+
/**
* Returns the list of preferred commands for a given MIME type.
* @param mimeType the MIME type
@@ -295,7 +295,7 @@ public class MailcapCommandMap
cmdList.toArray(cmds);
return cmds;
}
-
+
/**
* Returns all commands for the given MIME type.
* @param mimeType the MIME type
@@ -343,7 +343,7 @@ public class MailcapCommandMap
for (int j = 0; j < 5; j++)
{
Map<String,List<String>> map =
- getCommands(mailcaps[j][i], mimeType);
+ getCommands(mailcaps[j][i], mimeType);
if (map != null)
{
List<String> classNames = map.get(cmdName);
@@ -449,7 +449,7 @@ public class MailcapCommandMap
}
return null;
}
-
+
/**
* Get the native commands for the given MIME type.
* Returns an array of strings where each string is
@@ -479,8 +479,8 @@ public class MailcapCommandMap
}
private void addNativeCommands(List<String> acc,
- Map<String,Map<String,List<String>>> mailcap,
- String mimeType)
+ Map<String,Map<String,List<String>>> mailcap,
+ String mimeType)
{
for (Map.Entry<String,Map<String,List<String>>> mEntry : mailcap.entrySet())
{
@@ -522,7 +522,7 @@ public class MailcapCommandMap
}
}
}
-
+
private static String nameOf(int mailcap)
{
switch (mailcap)
@@ -539,7 +539,7 @@ public class MailcapCommandMap
return "DEF";
default:
return "ERR";
- }
+ }
}
private void parseFile(int index, String filename)
@@ -576,7 +576,7 @@ public class MailcapCommandMap
}
}
}
-
+
private void parseResource(int index, String name)
{
Reader in = null;
@@ -615,7 +615,7 @@ public class MailcapCommandMap
}
}
}
-
+
private void parse(int index, Reader in)
throws IOException
{
@@ -649,7 +649,7 @@ public class MailcapCommandMap
}
}
}
-
+
private void parseEntry(int index, String line)
{
// Tokenize entry into fields
@@ -691,7 +691,7 @@ public class MailcapCommandMap
fallback = true;
}
fields.add(field);
-
+
len = fields.size();
if (len < 2)
{
@@ -701,7 +701,7 @@ public class MailcapCommandMap
}
return;
}
-
+
Map<String,Map<String,List<String>>> mailcap =
fallback ? mailcaps[index][FALLBACK] : mailcaps[index][NORMAL];
String mimeType = fields.get(0);
@@ -711,9 +711,9 @@ public class MailcapCommandMap
addField(mailcap, mimeType, null, (String) fields.get(i));
}
}
-
+
private void addField(Map<String,Map<String,List<String>>> mailcap,
- String mimeType, String verb, String command)
+ String mimeType, String verb, String command)
{
if (verb == null)
{
@@ -728,7 +728,7 @@ public class MailcapCommandMap
{
return; // Invalid field or flag
}
-
+
Map<String,List<String>> commands = mailcap.get(mimeType);
if (commands == null)
{
@@ -743,10 +743,10 @@ public class MailcapCommandMap
}
classNames.add(command);
}
-
+
private Map<String,List<String>>
getCommands(Map<String,Map<String,List<String>>> mailcap,
- String mimeType)
+ String mimeType)
{
int si = mimeType.indexOf('/');
String genericMimeType = new CPStringBuilder(mimeType.substring(0, si))
@@ -782,7 +782,7 @@ public class MailcapCommandMap
}
// -- Utility methods --
-
+
private List<URL> getSystemResources(String name)
{
List<URL> acc = new ArrayList<URL>();
@@ -799,6 +799,5 @@ public class MailcapCommandMap
}
return acc;
}
-
-}
+}