diff options
author | Narayan Kamath <narayan@google.com> | 2015-04-21 11:08:07 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-04-21 11:08:07 +0000 |
commit | 7761a6006e15e8a1b38ada29ec804a0fb3b4f73f (patch) | |
tree | e8e2ae85b3913597783e7c174e1f0073d372db77 /luni | |
parent | 90fccec9aefb871ef3dd92a51f77264f2fe5e9e4 (diff) | |
parent | 69773bd217466a536c9317073a184d3907f58100 (diff) | |
download | libcore-7761a6006e15e8a1b38ada29ec804a0fb3b4f73f.zip libcore-7761a6006e15e8a1b38ada29ec804a0fb3b4f73f.tar.gz libcore-7761a6006e15e8a1b38ada29ec804a0fb3b4f73f.tar.bz2 |
am 69773bd2: am 21a0e54a: Merge "Remove support for reading mime types from property files."
* commit '69773bd217466a536c9317073a184d3907f58100':
Remove support for reading mime types from property files.
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/main/java/libcore/net/MimeUtils.java | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/luni/src/main/java/libcore/net/MimeUtils.java b/luni/src/main/java/libcore/net/MimeUtils.java index 2e72078..e36b3d1 100644 --- a/luni/src/main/java/libcore/net/MimeUtils.java +++ b/luni/src/main/java/libcore/net/MimeUtils.java @@ -16,13 +16,8 @@ package libcore.net; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; import java.util.HashMap; import java.util.Map; -import java.util.Properties; /** * Utilities for dealing with MIME types. @@ -382,7 +377,6 @@ public final class MimeUtils { add("video/x-webex", "wrf"); add("x-conference/x-cooltalk", "ice"); add("x-epoc/x-sisx-app", "sisx"); - applyOverrides(); } private static void add(String mimeType, String extension) { @@ -399,61 +393,6 @@ public final class MimeUtils { } } - private static InputStream getContentTypesPropertiesStream() { - // User override? - String userTable = System.getProperty("content.types.user.table"); - if (userTable != null) { - File f = new File(userTable); - if (f.exists()) { - try { - return new FileInputStream(f); - } catch (IOException ignored) { - } - } - } - - // Standard location? - File f = new File(System.getProperty("java.home"), "lib" + File.separator + "content-types.properties"); - if (f.exists()) { - try { - return new FileInputStream(f); - } catch (IOException ignored) { - } - } - - return null; - } - - /** - * This isn't what the RI does. The RI doesn't have hard-coded defaults, so supplying your - * own "content.types.user.table" means you don't get any of the built-ins, and the built-ins - * come from "$JAVA_HOME/lib/content-types.properties". - */ - private static void applyOverrides() { - // Get the appropriate InputStream to read overrides from, if any. - InputStream stream = getContentTypesPropertiesStream(); - if (stream == null) { - return; - } - - try { - try { - // Read the properties file... - Properties overrides = new Properties(); - overrides.load(stream); - // And translate its mapping to ours... - for (Map.Entry<Object, Object> entry : overrides.entrySet()) { - String extension = (String) entry.getKey(); - String mimeType = (String) entry.getValue(); - add(mimeType, extension); - } - } finally { - stream.close(); - } - } catch (IOException ignored) { - } - } - private MimeUtils() { } |