Android 應用程序之間內容分享詳解(一)

一個Andoird應用程序的重要的地方是他們有相互溝通和整合的能力,一個應用程序可以和另一個應用程序交互,接下來我們來看看Android應用之間的內容分享

當你構建Intent的時候,必須要指定Intent的Action觸發,定義Intent的Action例如ACTION_SEND,你大概可以猜到指定Action為ACTION_SEND的Intent的作用是從一個Activity發送數據到另一個Activity,甚至跨越不同的進程,將數據發送給另一個Activity,你需要指定數據和他的類型,系統將識別接收的Activity,並顯示他們給用戶(假如有多個選擇的時候)或者立即啟動Activity(隻要一個選擇的時候)

1.發送文本內容

最直接最常用的是用ACTION_SEND來從一個應用發送文本內容到另一個應用,例如,我們的內置瀏覽器可以與任何頁面當前的URL來共享文字,下面的例子就是共享文本內容

[java]
Intent sendIntent = new Intent(); 
sendIntent.setAction(Intent.ACTION_SEND); 
//這裡是你發送的文本  
sendIntent.putExtra(Intent.EXTRA_TEXT, "我用手機測試分享內容"); 
sendIntent.setType("text/plain"); 
startActivity(sendIntent); 

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
//這裡是你發送的文本
sendIntent.putExtra(Intent.EXTRA_TEXT, "我用手機測試分享內容");
sendIntent.setType("text/plain");
startActivity(sendIntent);假如你安裝瞭過濾Action為ACTION_SEND,MIMEtype為“text/plain”的應用程序,這個系統就會啟動,假如系統匹配到多個這樣子的應用程序,他就會彈出一個Dialog列出所有的應用供用戶選擇(一個選擇器),如下圖

 

可能你覺得上面的代碼很簡單,我很容易就能寫出來,可是你發現瞭沒有,當我們的手機裡面沒有地圖類型的應用程序,你執行startActivity方法,你的程序就會出現Crash(崩潰),所以我們需要先判斷下系統是否有這類型的應用程序,判斷也很簡單

 

[java]
public boolean hasApplication(Intent intent){   
        PackageManager packageManager = getPackageManager();   
        //查詢是否有該Intent的Activity    
        List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0);   
        //activities裡面不為空就有,否則就沒有    
        return activities.size() > 0 ? true : false;   

public boolean hasApplication(Intent intent){ 
        PackageManager packageManager = getPackageManager(); 
        //查詢是否有該Intent的Activity 
        List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0); 
        //activities裡面不為空就有,否則就沒有 
        return activities.size() > 0 ? true : false;  所以我們在startActivity的時候要做上面的判斷,這樣子我們開發出來的程序才會更加的健壯,少一些Crash用戶體驗也會更好,假如每次都要判斷你師傅會覺得煩?所以我們也可以使用Intent的Intent.createChooser方法

他有如下優點

1.1 即使用戶選擇瞭默認的方式,選擇器仍然會彈出來
1.2 如果沒有匹配到這樣的應用程序,系統就會提示消息
1.3 你可以指定選擇器Dialog的標題

[java]
Intent sendIntent = new Intent(); 
sendIntent.setAction(Intent.ACTION_SEND); 
sendIntent.putExtra(Intent.EXTRA_TEXT, "我用手機測試分享內容"); 
sendIntent.setType("text/plain"); 
startActivity(Intent.createChooser(sendIntent, "我是彈出框的標題")); 

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "我用手機測試分享內容");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "我是彈出框的標題"));註:某些郵件類應用程序,如Gmail,我們可以使用putExtra(Intent.EXTRA_EMAIL, String[]) 添加一個字符串數組到Intent中

 

2.發送二進制內容

二進制內容的共享使用Action為ACTION_SEND,在設置適當的MIME類型,並且添加putExtra(Intent.EXTRA_STREAM, URI),下面是一個常用的共享圖片的代碼,也可以共享任何類型的二進制內容

[java]
Intent shareIntent = new Intent(); 
shareIntent.setAction(Intent.ACTION_SEND); 
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage); 
shareIntent.setType("image/jpeg"); 
startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))); 

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage);
shareIntent.setType("image/jpeg");
startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to)));主要下面幾點

你可以使用MIME type為“ */*” ,他隻會匹配處理一般數據流的Activity
接收應用程序需要Uri指定數據的訪問權限
在SD卡的文件,我們使用File file = new File(filePath); Uri.fromFile(file),然後把他傳遞給Intent
在應用程序的目錄中,openFileOutput的模式為MODE_WORLD_READABLE,然後我們可以使用getFileStreamPath()返回一個File,然後利用Uri.fromFile(file)傳遞給Intent
可以掃描圖像,視頻和音頻等媒體文件,添加到系統MediaStore使用SCANFILE()來掃描文件,掃描完成後會調用 onScanCompleted()回調方法來返回一個Uri

圖片使用insertImage()方法插入到系統MediaStore也會返回一個圖片的Uri
下面是共享圖片的例子

[java]
Intent shareIntent = new Intent(); 
shareIntent.setAction(Intent.ACTION_SEND); 
File file = new File("mnt/sdcard/share.png"); 
             
System.out.println(Uri.fromFile(file)); 
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); 
shareIntent.setType("image/jpeg"); 
startActivity(Intent.createChooser(shareIntent, "共享圖片")); 

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
File file = new File("mnt/sdcard/share.png");
   
System.out.println(Uri.fromFile(file));
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
shareIntent.setType("image/jpeg");
startActivity(Intent.createChooser(shareIntent, "共享圖片"));選擇QQ空間後,圖片就顯示在那裡瞭,如下圖

 

我們要共享多個二進制內容利用Action為ACTION_SEND_MULTIPLE,下面是我們共享多張圖片

[java]
ArrayList<Uri> imageUris = new ArrayList<Uri>(); 
imageUris.add(imageUri1); // Add your image URIs here  
imageUris.add(imageUri2); 
 
Intent shareIntent = new Intent(); 
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE); 
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris); 
shareIntent.setType("image/*"); 
startActivity(Intent.createChooser(shareIntent, "Share images to..")); 

ArrayList<Uri> imageUris = new ArrayList<Uri>();
imageUris.add(imageUri1); // Add your image URIs here
imageUris.add(imageUri2);

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "Share images to.."));下面我列出幾個常用的MIME type類型

text/plain(純文本)

text/html(HTML文檔)

application/xhtml+xml(XHTML文檔)

image/gif(GIF圖像)

image/jpeg(JPEG圖像)【PHP中為:image/pjpeg】

image/png(PNG圖像)【PHP中為:image/x-png】

video/mpeg(MPEG動畫)

application/octet-stream(任意的二進制數據)

application/pdf(PDF文檔)

application/msword(Microsoft Word文件)

message/rfc822(RFC 822形式)

multipart/alternative(HTML郵件的HTML形式和純文本形式,相同內容使用不同形式表示)

application/x-www-form-urlencoded(使用HTTP的POST方法提交的表單)

multipart/form-data(同上,但主要用於表單提交時伴隨文件上傳的場合)

Android所有支持的MIME type

[java]
<SPAN style="WHITE-SPACE: pre">     </SPAN>sMimeTypeMap.loadEntry("application/andrew-inset", "ez"); 
           sMimeTypeMap.loadEntry("application/dsptype", "tsp"); 
           sMimeTypeMap.loadEntry("application/futuresplash", "spl"); 
           sMimeTypeMap.loadEntry("application/hta", "hta"); 
           sMimeTypeMap.loadEntry("application/mac-binhex40", "hqx"); 
           sMimeTypeMap.loadEntry("application/mac-compactpro", "cpt"); 
           sMimeTypeMap.loadEntry("application/mathematica", "nb"); 
           sMimeTypeMap.loadEntry("application/msaccess", "mdb"); 
           sMimeTypeMap.loadEntry("application/oda", "oda"); 
           sMimeTypeMap.loadEntry("application/ogg", "ogg"); 
           sMimeTypeMap.loadEntry("application/pdf", "pdf"); 
           sMimeTypeMap.loadEntry("application/pgp-keys", "key"); 
           sMimeTypeMap.loadEntry("application/pgp-signature", "pgp"); 
           sMimeTypeMap.loadEntry("application/pics-rules", "prf"); 
           sMimeTypeMap.loadEntry("application/rar", "rar"); 
           sMimeTypeMap.loadEntry("application/rdf+xml", "rdf"); 
           sMimeTypeMap.loadEntry("application/rss+xml", "rss"); 
           sMimeTypeMap.loadEntry("application/zip", "zip"); 
           sMimeTypeMap.loadEntry("application/vnd.android.package-archive",  
                   "apk"); 
           sMimeTypeMap.loadEntry("application/vnd.cinderella", "cdy"); 
           sMimeTypeMap.loadEntry("application/vnd.ms-pki.stl", "stl"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.database", "odb"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.formula", "odf"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.graphics", "odg"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.graphics-template", 
                   "otg"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.image", "odi"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.spreadsheet", "ods"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.spreadsheet-template", 
                   "ots"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.text", "odt"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.text-master", "odm"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.text-template", "ott"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.oasis.opendocument.text-web", "oth"); 
           sMimeTypeMap.loadEntry("application/msword", "doc"); 
           sMimeTypeMap.loadEntry("application/msword", "dot"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.openxmlformats-officedocument.wordprocessingml.document", 
                   "docx"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.openxmlformats-officedocument.wordprocessingml.template", 
                   "dotx"); 
           sMimeTypeMap.loadEntry("application/vnd.ms-excel", "xls"); 
           sMimeTypeMap.loadEntry("application/vnd.ms-excel", "xlt"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 
                   "xlsx"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.openxmlformats-officedocument.spreadsheetml.template", 
                   "xltx"); 
           sMimeTypeMap.loadEntry("application/vnd.ms-powerpoint", "ppt"); 
           sMimeTypeMap.loadEntry("application/vnd.ms-powerpoint", "pot"); 
           sMimeTypeMap.loadEntry("application/vnd.ms-powerpoint", "pps"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.openxmlformats-officedocument.presentationml.presentation", 
                   "pptx"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.openxmlformats-officedocument.presentationml.template", 
                   "potx"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.openxmlformats-officedocument.presentationml.slideshow", 
                   "ppsx"); 
           sMimeTypeMap.loadEntry("application/vnd.rim.cod", "cod"); 
           sMimeTypeMap.loadEntry("application/vnd.smaf", "mmf"); 
           sMimeTypeMap.loadEntry("application/vnd.starpision.calc", "sdc"); 
           sMimeTypeMap.loadEntry("application/vnd.starpision.draw", "sda"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.starpision.impress", "sdd"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.starpision.impress", "sdp"); 
           sMimeTypeMap.loadEntry("application/vnd.starpision.math", "smf"); 
           sMimeTypeMap.loadEntry("application/vnd.starpision.writer", 
                   "sdw"); 
           sMimeTypeMap.loadEntry("application/vnd.starpision.writer", 
                   "vor"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.starpision.writer-global", "sgl"); 
           sMimeTypeMap.loadEntry("application/vnd.sun.xml.calc", "sxc"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.sun.xml.calc.template", "stc"); 
           sMimeTypeMap.loadEntry("application/vnd.sun.xml.draw", "sxd"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.sun.xml.draw.template", "std"); 
           sMimeTypeMap.loadEntry("application/vnd.sun.xml.impress", "sxi"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.sun.xml.impress.template", "sti"); 
           sMimeTypeMap.loadEntry("application/vnd.sun.xml.math", "sxm"); 
           sMimeTypeMap.loadEntry("application/vnd.sun.xml.writer", "sxw"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.sun.xml.writer.global", "sxg"); 
           sMimeTypeMap.loadEntry( 
                   "application/vnd.sun.xml.writer.template", "stw"); 
           sMimeTypeMap.loadEntry("application/vnd.visio", "vsd"); 
           sMimeTypeMap.loadEntry("application/x-abiword", "abw"); 
           sMimeTypeMap.loadEntry("application/x-apple-diskimage", "dmg"); 
           sMimeTypeMap.loadEntry("application/x-bcpio", "bcpio"); 
           sMimeTypeMap.loadEntry("application/x-bittorrent", "torrent"); 
           sMimeTypeMap.loadEntry("application/x-cdf", "cdf"); 
           sMimeTypeMap.loadEntry("application/x-cdlink", "vcd"); 
           sMimeTypeMap.loadEntry("application/x-chess-pgn", "pgn"); 
           sMimeTypeMap.loadEntry("application/x-cpio", "cpio"); 
           sMimeTypeMap.loadEntry("application/x-debian-package", "deb"); 
           sMimeTypeMap.loadEntry("application/x-debian-package", "udeb"); 
           sMimeTypeMap.loadEntry("application/x-director", "dcr"); 
           sMimeTypeMap.loadEntry("application/x-director", "dir"); 
           sMimeTypeMap.loadEntry("application/x-director", "dxr"); 
           sMimeTypeMap.loadEntry("application/x-dms", "dms"); 
           sMimeTypeMap.loadEntry("application/x-doom", "wad"); 
           sMimeTypeMap.loadEntry("application/x-dvi", "dvi"); 
           sMimeTypeMap.loadEntry("application/x-flac", "flac"); 
           sMimeTypeMap.loadEntry("application/x-font", "pfa"); 
           sMimeTypeMap.loadEntry("application/x-font", "pfb"); 
           sMimeTypeMap.loadEntry("application/x-font", "gsf"); 
           sMimeTypeMap.loadEntry("application/x-font", "pcf"); 
           sMimeTypeMap.loadEntry("application/x-font", "pcf.Z"); 
           sMimeTypeMap.loadEntry("application/x-freemind", "mm"); 
           sMimeTypeMap.loadEntry("application/x-futuresplash", "spl"); 
           sMimeTypeMap.loadEntry("application/x-gnumeric", "gnumeric"); 
           sMimeTypeMap.loadEntry("application/x-go-sgf", "sgf"); 
           sMimeTypeMap.loadEntry("application/x-graphing-calculator", "gcf"); 
           sMimeTypeMap.loadEntry("application/x-gtar", "gtar"); 
           sMimeTypeMap.loadEntry("application/x-gtar", "tgz"); 
           sMimeTypeMap.loadEntry("application/x-gtar", "taz"); 
           sMimeTypeMap.loadEntry("application/x-hdf", "hdf"); 
           sMimeTypeMap.loadEntry("application/x-ica", "ica"); 
           sMimeTypeMap.loadEntry("application/x-internet-signup", "ins"); 
           sMimeTypeMap.loadEntry("application/x-internet-signup", "isp"); 
           sMimeTypeMap.loadEntry("application/x-iphone", "iii"); 
           sMimeTypeMap.loadEntry("application/x-iso9660-image", "iso"); 
           sMimeTypeMap.loadEntry("application/x-jmol", "jmz"); 
           sMimeTypeMap.loadEntry("application/x-kchart", "chrt"); 
           sMimeTypeMap.loadEntry("application/x-killustrator", "kil"); 
           sMimeTypeMap.loadEntry("application/x-koan", "skp"); 
           sMimeTypeMap.loadEntry("application/x-koan", "skd"); 
           sMimeTypeMap.loadEntry("application/x-koan", "skt"); 
           sMimeTypeMap.loadEntry("application/x-koan", "skm"); 
           sMimeTypeMap.loadEntry("application/x-kpresenter", "kpr"); 
           sMimeTypeMap.loadEntry("application/x-kpresenter", "kpt"); 
           sMimeTypeMap.loadEntry("application/x-kspread", "ksp"); 
           sMimeTypeMap.loadEntry("application/x-kword", "kwd"); 
           sMimeTypeMap.loadEntry("application/x-kword", "kwt"); 
           sMimeTypeMap.loadEntry("application/x-latex", "latex"); 
           sMimeTypeMap.loadEntry("application/x-lha", "lha"); 
           sMimeTypeMap.loadEntry("application/x-lzh", "lzh"); 
           sMimeTypeMap.loadEntry("application/x-lzx", "lzx"); 
           sMimeTypeMap.loadEntry("application/x-maker", "frm"); 
           sMimeTypeMap.loadEntry("application/x-maker", "maker"); 
           sMimeTypeMap.loadEntry("application/x-maker", "frame"); 
           sMimeTypeMap.loadEntry("application/x-maker", "fb"); 
           sMimeTypeMap.loadEntry("application/x-maker", "book"); 
           sMimeTypeMap.loadEntry("application/x-maker", "fbdoc"); 
           sMimeTypeMap.loadEntry("application/x-mif", "mif"); 
           sMimeTypeMap.loadEntry("application/x-ms-wmd", "wmd"); 
           sMimeTypeMap.loadEntry("application/x-ms-wmz", "wmz"); 
           sMimeTypeMap.loadEntry("application/x-msi", "msi"); 
           sMimeTypeMap.loadEntry("application/x-ns-proxy-autoconfig", "pac"); 
           sMimeTypeMap.loadEntry("application/x-nwc", "nwc"); 
           sMimeTypeMap.loadEntry("application/x-object", "o"); 
           sMimeTypeMap.loadEntry("application/x-oz-application", "oza"); 
           sMimeTypeMap.loadEntry("application/x-pkcs12", "p12"); 
           sMimeTypeMap.loadEntry("application/x-pkcs7-certreqresp", "p7r"); 
           sMimeTypeMap.loadEntry("application/x-pkcs7-crl", "crl"); 
           sMimeTypeMap.loadEntry("application/x-quicktimeplayer", "qtl"); 
           sMimeTypeMap.loadEntry("application/x-shar", "shar"); 
           sMimeTypeMap.loadEntry("application/x-shockwave-flash", "swf"); 
           sMimeTypeMap.loadEntry("application/x-stuffit", "sit"); 
           sMimeTypeMap.loadEntry("application/x-sv4cpio", "sv4cpio"); 
           sMimeTypeMap.loadEntry("application/x-sv4crc", "sv4crc"); 
           sMimeTypeMap.loadEntry("application/x-tar", "tar"); 
           sMimeTypeMap.loadEntry("application/x-texinfo", "texinfo"); 
           sMimeTypeMap.loadEntry("application/x-texinfo", "texi"); 
           sMimeTypeMap.loadEntry("application/x-troff", "t"); 
           sMimeTypeMap.loadEntry("application/x-troff", "roff"); 
           sMimeTypeMap.loadEntry("application/x-troff-man", "man"); 
           sMimeTypeMap.loadEntry("application/x-ustar", "ustar"); 
           sMimeTypeMap.loadEntry("application/x-wais-source", "src"); 
           sMimeTypeMap.loadEntry("application/x-wingz", "wz"); 
           sMimeTypeMap.loadEntry("application/x-webarchive", "webarchive"); 
           sMimeTypeMap.loadEntry("application/x-x509-ca-cert", "crt"); 
           sMimeTypeMap.loadEntry("application/x-x509-user-cert", "crt"); 
           sMimeTypeMap.loadEntry("application/x-xcf", "xcf"); 
           sMimeTypeMap.loadEntry("application/x-xfig", "fig"); 
           sMimeTypeMap.loadEntry("application/xhtml+xml", "xhtml"); 
           sMimeTypeMap.loadEntry("audio/3gpp", "3gpp"); 
           sMimeTypeMap.loadEntry("audio/basic", "snd"); 
           sMimeTypeMap.loadEntry("audio/midi", "mid"); 
           sMimeTypeMap.loadEntry("audio/midi", "midi"); 
           sMimeTypeMap.loadEntry("audio/midi", "kar"); 
           sMimeTypeMap.loadEntry("audio/mpeg", "mpga"); 
           sMimeTypeMap.loadEntry("audio/mpeg", "mpega"); 
           sMimeTypeMap.loadEntry("audio/mpeg", "mp2"); 
           sMimeTypeMap.loadEntry("audio/mpeg", "mp3"); 
           sMimeTypeMap.loadEntry("audio/mpeg", "m4a"); 
           sMimeTypeMap.loadEntry("audio/mpegurl", "m3u"); 
           sMimeTypeMap.loadEntry("audio/prs.sid", "sid"); 
           sMimeTypeMap.loadEntry("audio/x-aiff", "aif"); 
           sMimeTypeMap.loadEntry("audio/x-aiff", "aiff"); 
           sMimeTypeMap.loadEntry("audio/x-aiff", "aifc"); 
           sMimeTypeMap.loadEntry("audio/x-gsm", "gsm"); 
           sMimeTypeMap.loadEntry("audio/x-mpegurl", "m3u"); 
           sMimeTypeMap.loadEntry("audio/x-ms-wma", "wma"); 
           sMimeTypeMap.loadEntry("audio/x-ms-wax", "wax"); 
           sMimeTypeMap.loadEntry("audio/x-pn-realaudio", "ra"); 
           sMimeTypeMap.loadEntry("audio/x-pn-realaudio", "rm"); 
           sMimeTypeMap.loadEntry("audio/x-pn-realaudio", "ram"); 
           sMimeTypeMap.loadEntry("audio/x-realaudio", "ra"); 
           sMimeTypeMap.loadEntry("audio/x-scpls", "pls"); 
           sMimeTypeMap.loadEntry("audio/x-sd2", "sd2"); 
           sMimeTypeMap.loadEntry("audio/x-wav", "wav"); 
           sMimeTypeMap.loadEntry("image/bmp", "bmp"); 
           sMimeTypeMap.loadEntry("image/gif", "gif"); 
           sMimeTypeMap.loadEntry("image/ico", "cur"); 
           sMimeTypeMap.loadEntry("image/ico", "ico"); 
           sMimeTypeMap.loadEntry("image/ief", "ief"); 
           sMimeTypeMap.loadEntry("image/jpeg", "jpeg"); 
           sMimeTypeMap.loadEntry("image/jpeg", "jpg"); 
           sMimeTypeMap.loadEntry("image/jpeg", "jpe"); 
           sMimeTypeMap.loadEntry("image/pcx", "pcx"); 
           sMimeTypeMap.loadEntry("image/png", "png"); 
           sMimeTypeMap.loadEntry("image/svg+xml", "svg"); 
           sMimeTypeMap.loadEntry("image/svg+xml", "svgz"); 
           sMimeTypeMap.loadEntry("image/tiff", "tiff"); 
           sMimeTypeMap.loadEntry("image/tiff", "tif"); 
           sMimeTypeMap.loadEntry("image/vnd.djvu", "djvu"); 
           sMimeTypeMap.loadEntry("image/vnd.djvu", "djv"); 
           sMimeTypeMap.loadEntry("image/vnd.wap.wbmp", "wbmp"); 
           sMimeTypeMap.loadEntry("image/x-cmu-raster", "ras"); 
           sMimeTypeMap.loadEntry("image/x-coreldraw", "cdr"); 
           sMimeTypeMap.loadEntry("image/x-coreldrawpattern", "pat"); 
           sMimeTypeMap.loadEntry("image/x-coreldrawtemplate", "cdt"); 
           sMimeTypeMap.loadEntry("image/x-corelphotopaint", "cpt"); 
           sMimeTypeMap.loadEntry("image/x-icon", "ico"); 
           sMimeTypeMap.loadEntry("image/x-jg", "art"); 
           sMimeTypeMap.loadEntry("image/x-jng", "jng"); 
           sMimeTypeMap.loadEntry("image/x-ms-bmp", "bmp"); 
           sMimeTypeMap.loadEntry("image/x-photoshop", "psd"); 
           sMimeTypeMap.loadEntry("image/x-portable-anymap", "pnm"); 
           sMimeTypeMap.loadEntry("image/x-portable-bitmap", "pbm"); 
           sMimeTypeMap.loadEntry("image/x-portable-graymap", "pgm"); 
           sMimeTypeMap.loadEntry("image/x-portable-pixmap", "ppm"); 
           sMimeTypeMap.loadEntry("image/x-rgb", "rgb"); 
           sMimeTypeMap.loadEntry("image/x-xbitmap", "xbm"); 
           sMimeTypeMap.loadEntry("image/x-xpixmap", "xpm"); 
           sMimeTypeMap.loadEntry("image/x-xwindowdump", "xwd"); 
           sMimeTypeMap.loadEntry("model/iges", "igs"); 
           sMimeTypeMap.loadEntry("model/iges", "iges"); 
           sMimeTypeMap.loadEntry("model/mesh", "msh"); 
           sMimeTypeMap.loadEntry("model/mesh", "mesh"); 
           sMimeTypeMap.loadEntry("model/mesh", "silo"); 
           sMimeTypeMap.loadEntry("text/calendar", "ics"); 
           sMimeTypeMap.loadEntry("text/calendar", "icz"); 
           sMimeTypeMap.loadEntry("text/comma-separated-values", "csv"); 
           sMimeTypeMap.loadEntry("text/css", "css"); 
           sMimeTypeMap.loadEntry("text/html", "htm"); 
           sMimeTypeMap.loadEntry("text/html", "html"); 
           sMimeTypeMap.loadEntry("text/h323", "323"); 
           sMimeTypeMap.loadEntry("text/iuls", "uls"); 
           sMimeTypeMap.loadEntry("text/mathml", "mml"); 
           // add it first so it will be the default for ExtensionFromMimeType  
           sMimeTypeMap.loadEntry("text/plain", "txt"); 
           sMimeTypeMap.loadEntry("text/plain", "asc"); 
           sMimeTypeMap.loadEntry("text/plain", "text"); 
           sMimeTypeMap.loadEntry("text/plain", "diff"); 
           sMimeTypeMap.loadEntry("text/plain", "po");     // reserve "pot" for vnd.ms-powerpoint  
           sMimeTypeMap.loadEntry("text/richtext", "rtx"); 
           sMimeTypeMap.loadEntry("text/rtf", "rtf"); 
           sMimeTypeMap.loadEntry("text/texmacs", "ts"); 
           sMimeTypeMap.loadEntry("text/text", "phps"); 
           sMimeTypeMap.loadEntry("text/tab-separated-values", "tsv"); 
           sMimeTypeMap.loadEntry("text/xml", "xml"); 
           sMimeTypeMap.loadEntry("text/x-bibtex", "bib"); 
           sMimeTypeMap.loadEntry("text/x-boo", "boo"); 
           sMimeTypeMap.loadEntry("text/x-c++hdr", "h++"); 
           sMimeTypeMap.loadEntry("text/x-c++hdr", "hpp"); 
           sMimeTypeMap.loadEntry("text/x-c++hdr", "hxx"); 
           sMimeTypeMap.loadEntry("text/x-c++hdr", "hh"); 
           sMimeTypeMap.loadEntry("text/x-c++src", "c++"); 
           sMimeTypeMap.loadEntry("text/x-c++src", "cpp"); 
           sMimeTypeMap.loadEntry("text/x-c++src", "cxx"); 
           sMimeTypeMap.loadEntry("text/x-chdr", "h"); 
           sMimeTypeMap.loadEntry("text/x-component", "htc"); 
           sMimeTypeMap.loadEntry("text/x-csh", "csh"); 
           sMimeTypeMap.loadEntry("text/x-csrc", "c"); 
           sMimeTypeMap.loadEntry("text/x-dsrc", "d"); 
           sMimeTypeMap.loadEntry("text/x-haskell", "hs"); 
           sMimeTypeMap.loadEntry("text/x-java", "java"); 
           sMimeTypeMap.loadEntry("text/x-literate-haskell", "lhs"); 
           sMimeTypeMap.loadEntry("text/x-moc", "moc"); 
           sMimeTypeMap.loadEntry("text/x-pascal", "p"); 
           sMimeTypeMap.loadEntry("text/x-pascal", "pas"); 
           sMimeTypeMap.loadEntry("text/x-pcs-gcd", "gcd"); 
           sMimeTypeMap.loadEntry("text/x-setext", "etx"); 
           sMimeTypeMap.loadEntry("text/x-tcl", "tcl"); 
           sMimeTypeMap.loadEntry("text/x-tex", "tex"); 
           sMimeTypeMap.loadEntry("text/x-tex", "ltx"); 
           sMimeTypeMap.loadEntry("text/x-tex", "sty"); 
           sMimeTypeMap.loadEntry("text/x-tex", "cls"); 
           sMimeTypeMap.loadEntry("text/x-vcalendar", "vcs"); 
           sMimeTypeMap.loadEntry("text/x-vcard", "vcf"); 
           sMimeTypeMap.loadEntry("video/3gpp", "3gpp"); 
           sMimeTypeMap.loadEntry("video/3gpp", "3gp"); 
           sMimeTypeMap.loadEntry("video/3gpp", "3g2"); 
           sMimeTypeMap.loadEntry("video/dl", "dl"); 
           sMimeTypeMap.loadEntry("video/dv", "dif"); 
           sMimeTypeMap.loadEntry("video/dv", "dv"); 
           sMimeTypeMap.loadEntry("video/fli", "fli"); 
           sMimeTypeMap.loadEntry("video/m4v", "m4v"); 
           sMimeTypeMap.loadEntry("video/mpeg", "mpeg"); 
           sMimeTypeMap.loadEntry("video/mpeg", "mpg"); 
           sMimeTypeMap.loadEntry("video/mpeg", "mpe"); 
           sMimeTypeMap.loadEntry("video/mp4", "mp4"); 
           sMimeTypeMap.loadEntry("video/mpeg", "VOB"); 
           sMimeTypeMap.loadEntry("video/quicktime", "qt"); 
           sMimeTypeMap.loadEntry("video/quicktime", "mov"); 
           sMimeTypeMap.loadEntry("video/vnd.mpegurl", "mxu"); 
           sMimeTypeMap.loadEntry("video/x-la-asf", "lsf"); 
           sMimeTypeMap.loadEntry("video/x-la-asf", "lsx"); 
           sMimeTypeMap.loadEntry("video/x-mng", "mng"); 
           sMimeTypeMap.loadEntry("video/x-ms-asf", "asf"); 
           sMimeTypeMap.loadEntry("video/x-ms-asf", "asx"); 
           sMimeTypeMap.loadEntry("video/x-ms-wm", "wm"); 
           sMimeTypeMap.loadEntry("video/x-ms-wmv", "wmv"); 
           sMimeTypeMap.loadEntry("video/x-ms-wmx", "wmx"); 
           sMimeTypeMap.loadEntry("video/x-ms-wvx", "wvx"); 
           sMimeTypeMap.loadEntry("video/x-msvideo", "avi"); 
           sMimeTypeMap.loadEntry("video/x-sgi-movie", "movie"); 
           sMimeTypeMap.loadEntry("x-conference/x-cooltalk", "ice"); 
           sMimeTypeMap.loadEntry("x-epoc/x-sisx-app", "sisx"); 

   sMimeTypeMap.loadEntry("application/andrew-inset", "ez");
            sMimeTypeMap.loadEntry("application/dsptype", "tsp");
            sMimeTypeMap.loadEntry("application/futuresplash", "spl");
            sMimeTypeMap.loadEntry("application/hta", "hta");
            sMimeTypeMap.loadEntry("application/mac-binhex40", "hqx");
            sMimeTypeMap.loadEntry("application/mac-compactpro", "cpt");
            sMimeTypeMap.loadEntry("application/mathematica", "nb");
            sMimeTypeMap.loadEntry("application/msaccess", "mdb");
            sMimeTypeMap.loadEntry("application/oda", "oda");
            sMimeTypeMap.loadEntry("application/ogg", "ogg");
            sMimeTypeMap.loadEntry("application/pdf", "pdf");
            sMimeTypeMap.loadEntry("application/pgp-keys", "key");
            sMimeTypeMap.loadEntry("application/pgp-signature", "pgp");
            sMimeTypeMap.loadEntry("application/pics-rules", "prf");
            sMimeTypeMap.loadEntry("application/rar", "rar");
            sMimeTypeMap.loadEntry("application/rdf+xml", "rdf");
            sMimeTypeMap.loadEntry("application/rss+xml", "rss");
            sMimeTypeMap.loadEntry("application/zip", "zip");
            sMimeTypeMap.loadEntry("application/vnd.android.package-archive",
                    "apk");
            sMimeTypeMap.loadEntry("application/vnd.cinderella", "cdy");
            sMimeTypeMap.loadEntry("application/vnd.ms-pki.stl", "stl");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.database", "odb");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.formula", "odf");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.graphics", "odg");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.graphics-template",
                    "otg");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.image", "odi");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.spreadsheet", "ods");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.spreadsheet-template",
                    "ots");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.text", "odt");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.text-master", "odm");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.text-template", "ott");
            sMimeTypeMap.loadEntry(
                    "application/vnd.oasis.opendocument.text-web", "oth");
            sMimeTypeMap.loadEntry("application/msword", "doc");
            sMimeTypeMap.loadEntry("application/msword", "dot");
            sMimeTypeMap.loadEntry(
                    "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                    "docx");
            sMimeTypeMap.loadEntry(
                    "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
                    "dotx");
            sMimeTypeMap.loadEntry("application/vnd.ms-excel", "xls");
            sMimeTypeMap.loadEntry("application/vnd.ms-excel", "xlt");
            sMimeTypeMap.loadEntry(
                    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                    "xlsx");
            sMimeTypeMap.loadEntry(
                    "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
                    "xltx");
            sMimeTypeMap.loadEntry("application/vnd.ms-powerpoint", "ppt");
            sMimeTypeMap.loadEntry("application/vnd.ms-powerpoint", "pot");
            sMimeTypeMap.loadEntry("application/vnd.ms-powerpoint", "pps");
            sMimeTypeMap.loadEntry(
                    "application/vnd.openxmlformats-officedocument.presentationml.presentation",
                    "pptx");
            sMimeTypeMap.loadEntry(
                    "application/vnd.openxmlformats-officedocument.presentationml.template",
                    "potx");
            sMimeTypeMap.loadEntry(
                    "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
                    "ppsx");
            sMimeTypeMap.loadEntry("application/vnd.rim.cod", "cod");
            sMimeTypeMap.loadEntry("application/vnd.smaf", "mmf");
            sMimeTypeMap.loadEntry("application/vnd.starpision.calc", "sdc");
            sMimeTypeMap.loadEntry("application/vnd.starpision.draw", "sda");
            sMimeTypeMap.loadEntry(
                    "application/vnd.starpision.impress", "sdd");
            sMimeTypeMap.loadEntry(
                    "application/vnd.starpision.impress", "sdp");
            sMimeTypeMap.loadEntry("application/vnd.starpision.math", "smf");
            sMimeTypeMap.loadEntry("application/vnd.starpision.writer",
                    "sdw");
            sMimeTypeMap.loadEntry("application/vnd.starpision.writer",
                    "vor");
            sMimeTypeMap.loadEntry(
                    "application/vnd.starpision.writer-global", "sgl");
            sMimeTypeMap.loadEntry("application/vnd.sun.xml.calc", "sxc");
            sMimeTypeMap.loadEntry(
                    "application/vnd.sun.xml.calc.template", "stc");
            sMimeTypeMap.loadEntry("application/vnd.sun.xml.draw", "sxd");
            sMimeTypeMap.loadEntry(
                    "application/vnd.sun.xml.draw.template", "std");
            sMimeTypeMap.loadEntry("application/vnd.sun.xml.impress", "sxi");
            sMimeTypeMap.loadEntry(
                    "application/vnd.sun.xml.impress.template", "sti");
            sMimeTypeMap.loadEntry("application/vnd.sun.xml.math", "sxm");
            sMimeTypeMap.loadEntry("application/vnd.sun.xml.writer", "sxw");
            sMimeTypeMap.loadEntry(
                    "application/vnd.sun.xml.writer.global", "sxg");
            sMimeTypeMap.loadEntry(
                    "application/vnd.sun.xml.writer.template", "stw");
            sMimeTypeMap.loadEntry("application/vnd.visio", "vsd");
            sMimeTypeMap.loadEntry("application/x-abiword", "abw");
            sMimeTypeMap.loadEntry("application/x-apple-diskimage", "dmg");
            sMimeTypeMap.loadEntry("application/x-bcpio", "bcpio");
            sMimeTypeMap.loadEntry("application/x-bittorrent", "torrent");
            sMimeTypeMap.loadEntry("application/x-cdf", "cdf");
            sMimeTypeMap.loadEntry("application/x-cdlink", "vcd");
            sMimeTypeMap.loadEntry("application/x-chess-pgn", "pgn");
            sMimeTypeMap.loadEntry("application/x-cpio", "cpio");
            sMimeTypeMap.loadEntry("application/x-debian-package", "deb");
            sMimeTypeMap.loadEntry("application/x-debian-package", "udeb");
            sMimeTypeMap.loadEntry("application/x-director", "dcr");
            sMimeTypeMap.loadEntry("application/x-director", "dir");
            sMimeTypeMap.loadEntry("application/x-director", "dxr");
            sMimeTypeMap.loadEntry("application/x-dms", "dms");
            sMimeTypeMap.loadEntry("application/x-doom", "wad");
            sMimeTypeMap.loadEntry("application/x-dvi", "dvi");
            sMimeTypeMap.loadEntry("application/x-flac", "flac");
            sMimeTypeMap.loadEntry("application/x-font", "pfa");
            sMimeTypeMap.loadEntry("application/x-font", "pfb");
            sMimeTypeMap.loadEntry("application/x-font", "gsf");
            sMimeTypeMap.loadEntry("application/x-font", "pcf");
            sMimeTypeMap.loadEntry("application/x-font", "pcf.Z");
            sMimeTypeMap.loadEntry("application/x-freemind", "mm");
            sMimeTypeMap.loadEntry("application/x-futuresplash", "spl");
            sMimeTypeMap.loadEntry("application/x-gnumeric", "gnumeric");
            sMimeTypeMap.loadEntry("application/x-go-sgf", "sgf");
            sMimeTypeMap.loadEntry("application/x-graphing-calculator", "gcf");
            sMimeTypeMap.loadEntry("application/x-gtar", "gtar");
            sMimeTypeMap.loadEntry("application/x-gtar", "tgz");
            sMimeTypeMap.loadEntry("application/x-gtar", "taz");
            sMimeTypeMap.loadEntry("application/x-hdf", "hdf");
            sMimeTypeMap.loadEntry("application/x-ica", "ica");
            sMimeTypeMap.loadEntry("application/x-internet-signup", "ins");
            sMimeTypeMap.loadEntry("application/x-internet-signup", "isp");
            sMimeTypeMap.loadEntry("application/x-iphone", "iii");
            sMimeTypeMap.loadEntry("application/x-iso9660-image", "iso");
            sMimeTypeMap.loadEntry("application/x-jmol", "jmz");
            sMimeTypeMap.loadEntry("application/x-kchart", "chrt");
            sMimeTypeMap.loadEntry("application/x-killustrator", "kil");
            sMimeTypeMap.loadEntry("application/x-koan", "skp");
            sMimeTypeMap.loadEntry("application/x-koan", "skd");
            sMimeTypeMap.loadEntry("application/x-koan", "skt");
            sMimeTypeMap.loadEntry("application/x-koan", "skm");
            sMimeTypeMap.loadEntry("application/x-kpresenter", "kpr");
            sMimeTypeMap.loadEntry("application/x-kpresenter", "kpt");
            sMimeTypeMap.loadEntry("application/x-kspread", "ksp");
            sMimeTypeMap.loadEntry("application/x-kword", "kwd");
            sMimeTypeMap.loadEntry("application/x-kword", "kwt");
            sMimeTypeMap.loadEntry("application/x-latex", "latex");
            sMimeTypeMap.loadEntry("application/x-lha", "lha");
            sMimeTypeMap.loadEntry("application/x-lzh", "lzh");
            sMimeTypeMap.loadEntry("application/x-lzx", "lzx");
            sMimeTypeMap.loadEntry("application/x-maker", "frm");
            sMimeTypeMap.loadEntry("application/x-maker", "maker");
            sMimeTypeMap.loadEntry("application/x-maker", "frame");
            sMimeTypeMap.loadEntry("application/x-maker", "fb");
            sMimeTypeMap.loadEntry("application/x-maker", "book");
            sMimeTypeMap.loadEntry("application/x-maker", "fbdoc");
            sMimeTypeMap.loadEntry("application/x-mif", "mif");
            sMimeTypeMap.loadEntry("application/x-ms-wmd", "wmd");
            sMimeTypeMap.loadEntry("application/x-ms-wmz", "wmz");
            sMimeTypeMap.loadEntry("application/x-msi", "msi");
            sMimeTypeMap.loadEntry("application/x-ns-proxy-autoconfig", "pac");
            sMimeTypeMap.loadEntry("application/x-nwc", "nwc");
            sMimeTypeMap.loadEntry("application/x-object", "o");
            sMimeTypeMap.loadEntry("application/x-oz-application", "oza");
            sMimeTypeMap.loadEntry("application/x-pkcs12", "p12");
            sMimeTypeMap.loadEntry("application/x-pkcs7-certreqresp", "p7r");
            sMimeTypeMap.loadEntry("application/x-pkcs7-crl", "crl");
            sMimeTypeMap.loadEntry("application/x-quicktimeplayer", "qtl");
            sMimeTypeMap.loadEntry("application/x-shar", "shar");
            sMimeTypeMap.loadEntry("application/x-shockwave-flash", "swf");
            sMimeTypeMap.loadEntry("application/x-stuffit", "sit");
            sMimeTypeMap.loadEntry("application/x-sv4cpio", "sv4cpio");
            sMimeTypeMap.loadEntry("application/x-sv4crc", "sv4crc");
            sMimeTypeMap.loadEntry("application/x-tar", "tar");
            sMimeTypeMap.loadEntry("application/x-texinfo", "texinfo");
            sMimeTypeMap.loadEntry("application/x-texinfo", "texi");
            sMimeTypeMap.loadEntry("application/x-troff", "t");
            sMimeTypeMap.loadEntry("application/x-troff", "roff");
            sMimeTypeMap.loadEntry("application/x-troff-man", "man");
            sMimeTypeMap.loadEntry("application/x-ustar", "ustar");
            sMimeTypeMap.loadEntry("application/x-wais-source", "src");
            sMimeTypeMap.loadEntry("application/x-wingz", "wz");
            sMimeTypeMap.loadEntry("application/x-webarchive", "webarchive");
            sMimeTypeMap.loadEntry("application/x-x509-ca-cert", "crt");
            sMimeTypeMap.loadEntry("application/x-x509-user-cert", "crt");
            sMimeTypeMap.loadEntry("application/x-xcf", "xcf");
            sMimeTypeMap.loadEntry("application/x-xfig", "fig");
            sMimeTypeMap.loadEntry("application/xhtml+xml", "xhtml");
            sMimeTypeMap.loadEntry("audio/3gpp", "3gpp");
            sMimeTypeMap.loadEntry("audio/basic", "snd");
            sMimeTypeMap.loadEntry("audio/midi", "mid");
            sMimeTypeMap.loadEntry("audio/midi", "midi");
            sMimeTypeMap.loadEntry("audio/midi", "kar");
            sMimeTypeMap.loadEntry("audio/mpeg", "mpga");
            sMimeTypeMap.loadEntry("audio/mpeg", "mpega");
            sMimeTypeMap.loadEntry("audio/mpeg", "mp2");
            sMimeTypeMap.loadEntry("audio/mpeg", "mp3");
            sMimeTypeMap.loadEntry("audio/mpeg", "m4a");
            sMimeTypeMap.loadEntry("audio/mpegurl", "m3u");
            sMimeTypeMap.loadEntry("audio/prs.sid", "sid");
            sMimeTypeMap.loadEntry("audio/x-aiff", "aif");
            sMimeTypeMap.loadEntry("audio/x-aiff", "aiff");
            sMimeTypeMap.loadEntry("audio/x-aiff", "aifc");
            sMimeTypeMap.loadEntry("audio/x-gsm", "gsm");
            sMimeTypeMap.loadEntry("audio/x-mpegurl", "m3u");
            sMimeTypeMap.loadEntry("audio/x-ms-wma", "wma");
            sMimeTypeMap.loadEntry("audio/x-ms-wax", "wax");
            sMimeTypeMap.loadEntry("audio/x-pn-realaudio", "ra");
            sMimeTypeMap.loadEntry("audio/x-pn-realaudio", "rm");
            sMimeTypeMap.loadEntry("audio/x-pn-realaudio", "ram");
            sMimeTypeMap.loadEntry("audio/x-realaudio", "ra");
            sMimeTypeMap.loadEntry("audio/x-scpls", "pls");
            sMimeTypeMap.loadEntry("audio/x-sd2", "sd2");
            sMimeTypeMap.loadEntry("audio/x-wav", "wav");
            sMimeTypeMap.loadEntry("image/bmp", "bmp");
            sMimeTypeMap.loadEntry("image/gif", "gif");
            sMimeTypeMap.loadEntry("image/ico", "cur");
            sMimeTypeMap.loadEntry("image/ico", "ico");
            sMimeTypeMap.loadEntry("image/ief", "ief");
            sMimeTypeMap.loadEntry("image/jpeg", "jpeg");
            sMimeTypeMap.loadEntry("image/jpeg", "jpg");
            sMimeTypeMap.loadEntry("image/jpeg", "jpe");
            sMimeTypeMap.loadEntry("image/pcx", "pcx");
            sMimeTypeMap.loadEntry("image/png", "png");
            sMimeTypeMap.loadEntry("image/svg+xml", "svg");
            sMimeTypeMap.loadEntry("image/svg+xml", "svgz");
            sMimeTypeMap.loadEntry("image/tiff", "tiff");
            sMimeTypeMap.loadEntry("image/tiff", "tif");
            sMimeTypeMap.loadEntry("image/vnd.djvu", "djvu");
            sMimeTypeMap.loadEntry("image/vnd.djvu", "djv");
            sMimeTypeMap.loadEntry("image/vnd.wap.wbmp", "wbmp");
            sMimeTypeMap.loadEntry("image/x-cmu-raster", "ras");
            sMimeTypeMap.loadEntry("image/x-coreldraw", "cdr");
            sMimeTypeMap.loadEntry("image/x-coreldrawpattern", "pat");
            sMimeTypeMap.loadEntry("image/x-coreldrawtemplate", "cdt");
            sMimeTypeMap.loadEntry("image/x-corelphotopaint", "cpt");
            sMimeTypeMap.loadEntry("image/x-icon", "ico");
            sMimeTypeMap.loadEntry("image/x-jg", "art");
            sMimeTypeMap.loadEntry("image/x-jng", "jng");
            sMimeTypeMap.loadEntry("image/x-ms-bmp", "bmp");
            sMimeTypeMap.loadEntry("image/x-photoshop", "psd");
            sMimeTypeMap.loadEntry("image/x-portable-anymap", "pnm");
            sMimeTypeMap.loadEntry("image/x-portable-bitmap", "pbm");
            sMimeTypeMap.loadEntry("image/x-portable-graymap", "pgm");
            sMimeTypeMap.loadEntry("image/x-portable-pixmap", "ppm");
            sMimeTypeMap.loadEntry("image/x-rgb", "rgb");
            sMimeTypeMap.loadEntry("image/x-xbitmap", "xbm");
            sMimeTypeMap.loadEntry("image/x-xpixmap", "xpm");
            sMimeTypeMap.loadEntry("image/x-xwindowdump", "xwd");
            sMimeTypeMap.loadEntry("model/iges", "igs");
            sMimeTypeMap.loadEntry("model/iges", "iges");
            sMimeTypeMap.loadEntry("model/mesh", "msh");
            sMimeTypeMap.loadEntry("model/mesh", "mesh");
            sMimeTypeMap.loadEntry("model/mesh", "silo");
            sMimeTypeMap.loadEntry("text/calendar", "ics");
            sMimeTypeMap.loadEntry("text/calendar", "icz");
            sMimeTypeMap.loadEntry("text/comma-separated-values", "csv");
            sMimeTypeMap.loadEntry("text/css", "css");
            sMimeTypeMap.loadEntry("text/html", "htm");
            sMimeTypeMap.loadEntry("text/html", "html");
            sMimeTypeMap.loadEntry("text/h323", "323");
            sMimeTypeMap.loadEntry("text/iuls", "uls");
            sMimeTypeMap.loadEntry("text/mathml", "mml");
            // add it first so it will be the default for ExtensionFromMimeType
            sMimeTypeMap.loadEntry("text/plain", "txt");
            sMimeTypeMap.loadEntry("text/plain", "asc");
            sMimeTypeMap.loadEntry("text/plain", "text");
            sMimeTypeMap.loadEntry("text/plain", "diff");
            sMimeTypeMap.loadEntry("text/plain", "po");     // reserve "pot" for vnd.ms-powerpoint
            sMimeTypeMap.loadEntry("text/richtext", "rtx");
            sMimeTypeMap.loadEntry("text/rtf", "rtf");
            sMimeTypeMap.loadEntry("text/texmacs", "ts");
            sMimeTypeMap.loadEntry("text/text", "phps");
            sMimeTypeMap.loadEntry("text/tab-separated-values", "tsv");
            sMimeTypeMap.loadEntry("text/xml", "xml");
            sMimeTypeMap.loadEntry("text/x-bibtex", "bib");
            sMimeTypeMap.loadEntry("text/x-boo", "boo");
            sMimeTypeMap.loadEntry("text/x-c++hdr", "h++");
            sMimeTypeMap.loadEntry("text/x-c++hdr", "hpp");
            sMimeTypeMap.loadEntry("text/x-c++hdr", "hxx");
            sMimeTypeMap.loadEntry("text/x-c++hdr", "hh");
            sMimeTypeMap.loadEntry("text/x-c++src", "c++");
            sMimeTypeMap.loadEntry("text/x-c++src", "cpp");
            sMimeTypeMap.loadEntry("text/x-c++src", "cxx");
            sMimeTypeMap.loadEntry("text/x-chdr", "h");
            sMimeTypeMap.loadEntry("text/x-component", "htc");
            sMimeTypeMap.loadEntry("text/x-csh", "csh");
            sMimeTypeMap.loadEntry("text/x-csrc", "c");
            sMimeTypeMap.loadEntry("text/x-dsrc", "d");
            sMimeTypeMap.loadEntry("text/x-haskell", "hs");
            sMimeTypeMap.loadEntry("text/x-java", "java");
            sMimeTypeMap.loadEntry("text/x-literate-haskell", "lhs");
            sMimeTypeMap.loadEntry("text/x-moc", "moc");
            sMimeTypeMap.loadEntry("text/x-pascal", "p");
            sMimeTypeMap.loadEntry("text/x-pascal", "pas");
            sMimeTypeMap.loadEntry("text/x-pcs-gcd", "gcd");
            sMimeTypeMap.loadEntry("text/x-setext", "etx");
            sMimeTypeMap.loadEntry("text/x-tcl", "tcl");
            sMimeTypeMap.loadEntry("text/x-tex", "tex");
            sMimeTypeMap.loadEntry("text/x-tex", "ltx");
            sMimeTypeMap.loadEntry("text/x-tex", "sty");
            sMimeTypeMap.loadEntry("text/x-tex", "cls");
            sMimeTypeMap.loadEntry("text/x-vcalendar", "vcs");
            sMimeTypeMap.loadEntry("text/x-vcard", "vcf");
            sMimeTypeMap.loadEntry("video/3gpp", "3gpp");
            sMimeTypeMap.loadEntry("video/3gpp", "3gp");
            sMimeTypeMap.loadEntry("video/3gpp", "3g2");
            sMimeTypeMap.loadEntry("video/dl", "dl");
            sMimeTypeMap.loadEntry("video/dv", "dif");
            sMimeTypeMap.loadEntry("video/dv", "dv");
            sMimeTypeMap.loadEntry("video/fli", "fli");
            sMimeTypeMap.loadEntry("video/m4v", "m4v");
            sMimeTypeMap.loadEntry("video/mpeg", "mpeg");
            sMimeTypeMap.loadEntry("video/mpeg", "mpg");
            sMimeTypeMap.loadEntry("video/mpeg", "mpe");
            sMimeTypeMap.loadEntry("video/mp4", "mp4");
            sMimeTypeMap.loadEntry("video/mpeg", "VOB");
            sMimeTypeMap.loadEntry("video/quicktime", "qt");
            sMimeTypeMap.loadEntry("video/quicktime", "mov");
            sMimeTypeMap.loadEntry("video/vnd.mpegurl", "mxu");
            sMimeTypeMap.loadEntry("video/x-la-asf", "lsf");
            sMimeTypeMap.loadEntry("video/x-la-asf", "lsx");
            sMimeTypeMap.loadEntry("video/x-mng", "mng");
            sMimeTypeMap.loadEntry("video/x-ms-asf", "asf");
            sMimeTypeMap.loadEntry("video/x-ms-asf", "asx");
            sMimeTypeMap.loadEntry("video/x-ms-wm", "wm");
            sMimeTypeMap.loadEntry("video/x-ms-wmv", "wmv");
            sMimeTypeMap.loadEntry("video/x-ms-wmx", "wmx");
            sMimeTypeMap.loadEntry("video/x-ms-wvx", "wvx");
            sMimeTypeMap.loadEntry("video/x-msvideo", "avi");
            sMimeTypeMap.loadEntry("video/x-sgi-movie", "movie");
            sMimeTypeMap.loadEntry("x-conference/x-cooltalk", "ice");
            sMimeTypeMap.loadEntry("x-epoc/x-sisx-app", "sisx");上面是發送內容給其他的應用程序,接下來我們分享從其他的應用接收內容,謝謝大傢的關註!

 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *