package Ġal ire z at 7 7 5 . lib . downloader . helper čĊč Ċ import Ġandroidx . annotation . Size č Ċ import Ġjava . util .* č Ċ import Ġjava . util . regex . Pattern čĊč Ċ /** čĊ Ġ* ĠAuthor : Ġ ĠAli re za ĠT iz fa hm ĠF ard čĊ Ġ* ĠDate : ĠĠĠĠ 2 1 / 6 / 2 0 1 9 čĊ Ġ* ĠEmail : ĠĠ Ġal ire z at 7 7 5 @ gmail . com čĊ Ġ*/ čĊč Ċ internal Ġobject ĠMime Helper Ġ{ čĊčĊĠĠĠ Ġprivate Ġval ĠmimeType To Extension Map Ġ= ĠHashMap < String , ĠString >() čĊĠĠĠ Ġprivate Ġval Ġextension To MimeType Map Ġ= ĠHashMap < String , ĠString >() čĊčĊĠĠĠ Ġinit Ġ{ čĊĠĠĠĠĠĠĠ Ġadd (" application / and rew - in set ", Ġ" ez ") čĊĠĠĠĠĠĠĠ Ġadd (" application / ds ptype ", Ġ" t sp ") čĊĠĠĠĠĠĠĠ Ġadd (" application / future splash ", Ġ" spl ") čĊĠĠĠĠĠĠĠ Ġadd (" application / ht a ", Ġ" ht a ") čĊĠĠĠĠĠĠĠ Ġadd (" application / mac - bin hex 4 0 ", Ġ" hq x ") čĊĠĠĠĠĠĠĠ Ġadd (" application / mac - compact pro ", Ġ" cpt ") čĊĠĠĠĠĠĠĠ Ġadd (" application / mat hematic a ", Ġ" nb ") čĊĠĠĠĠĠĠĠ Ġadd (" application / ms access ", Ġ" mdb ") čĊĠĠĠĠĠĠĠ Ġadd (" application / oda ", Ġ" oda ") čĊĠĠĠĠĠĠĠ Ġadd (" application / ogg ", Ġ" ogg ") čĊĠĠĠĠĠĠĠ Ġadd (" application / ogg ", Ġ" oga ") čĊĠĠĠĠĠĠĠ Ġadd (" application / pdf ", Ġ" pdf ") čĊĠĠĠĠĠĠĠ Ġadd (" application / pgp - keys ", Ġ" key ") čĊĠĠĠĠĠĠĠ Ġadd (" application / pgp - signature ", Ġ" pgp ") čĊĠĠĠĠĠĠĠ Ġadd (" application / p ics - rules ", Ġ" pr f ") čĊĠĠĠĠĠĠĠ Ġadd (" application / pk ix - cert ", Ġ" cer ") čĊĠĠĠĠĠĠĠ Ġadd (" application / rar ", Ġ" rar ") čĊĠĠĠĠĠĠĠ Ġadd (" application / rdf + xml ", Ġ" rdf ") čĊĠĠĠĠĠĠĠ Ġadd (" application / rss + xml ", Ġ" rss ") čĊĠĠĠĠĠĠĠ Ġadd (" application / zip ", Ġ" zip ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . android . package - archive ", Ġ" apk ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . c inder ella ", Ġ" cd y ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . ms - pki . stl ", Ġ" stl ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . database ", Ġ" odb ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . formula ", Ġ" od f ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . graphics ", Ġ" od g ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . graphics - template ", Ġ" otg ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . image ", Ġ" odi ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . spreadsheet ", Ġ" ods ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . spreadsheet - template ", Ġ" ots ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . text ", Ġ" od t ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . text - master ", Ġ" od m ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . text - template ", Ġ" ott ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . oasis . opend ocument . text - web ", Ġ" oth ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . google - earth . k ml + xml ", Ġ" k ml ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . google - earth . km z ", Ġ" km z ") čĊĠĠĠĠĠĠĠ Ġadd (" application / ms word ", Ġ" doc ") čĊĠĠĠĠĠĠĠ Ġadd (" application / ms word ", Ġ" dot ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . open xm lform ats - off iced ocument . word processing ml . document ", Ġ" docx ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . open xm lform ats - off iced ocument . word processing ml . template ", Ġ" dot x ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . ms - excel ", Ġ" xls ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . ms - excel ", Ġ" x lt ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . open xm lform ats - off iced ocument . spreadsheet ml . sheet ", Ġ" xlsx ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . open xm lform ats - off iced ocument . spreadsheet ml . template ", Ġ" xl tx ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . ms - power point ", Ġ" ppt ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . ms - power point ", Ġ" pot ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . ms - power point ", Ġ" pp s ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . open xm lform ats - off iced ocument . presentation ml . presentation ", Ġ" ppt x ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . open xm lform ats - off iced ocument . presentation ml . template ", Ġ" pot x ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . open xm lform ats - off iced ocument . presentation ml . slide show ", Ġ" pp sx ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . rim . cod ", Ġ" cod ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . s ma f ", Ġ" mm f ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . star division . calc ", Ġ" sd c ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . star division . draw ", Ġ" sda ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . star division . imp ress ", Ġ" s dd ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . star division . imp ress ", Ġ" sdp ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . star division . math ", Ġ" sm f ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . star division . writer ", Ġ" sd w ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . star division . writer ", Ġ" vor ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . star division . writer - global ", Ġ" s gl ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . calc ", Ġ" s xc ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . calc . template ", Ġ" stc ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . draw ", Ġ" s xd ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . draw . template ", Ġ" std ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . imp ress ", Ġ" s xi ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . imp ress . template ", Ġ" st i ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . math ", Ġ" s xm ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . writer ", Ġ" sx w ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . writer . global ", Ġ" sx g ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . sun . xml . writer . template ", Ġ" stw ") čĊĠĠĠĠĠĠĠ Ġadd (" application / vnd . vis io ", Ġ" v sd ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - abi word ", Ġ" ab w ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - apple - disk image ", Ġ" dmg ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - b cp io ", Ġ" b cp io ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - bit torrent ", Ġ" torrent ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - cdf ", Ġ" cdf ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - cd link ", Ġ" v cd ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - chess - p gn ", Ġ" p gn ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - cp io ", Ġ" cp io ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - debian - package ", Ġ" deb ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - debian - package ", Ġ" ude b ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - director ", Ġ" d cr ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - director ", Ġ" dir ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - director ", Ġ" dx r ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - d ms ", Ġ" d ms ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - do om ", Ġ" w ad ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - d vi ", Ġ" d vi ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - fl ac ", Ġ" fl ac ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - font ", Ġ" p fa ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - font ", Ġ" p fb ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - font ", Ġ" gs f ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - font ", Ġ" pc f ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - font ", Ġ" pc f . Z ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - fre em ind ", Ġ" mm ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - future splash ", Ġ" spl ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - g numeric ", Ġ" g numeric ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - go - sg f ", Ġ" sg f ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - graph ing - calculator ", Ġ" g cf ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - gt ar ", Ġ" tgz ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - gt ar ", Ġ" gt ar ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - gt ar ", Ġ" ta z ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - hdf ", Ġ" hdf ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - ica ", Ġ" ica ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - internet - signup ", Ġ" ins ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - internet - signup ", Ġ" isp ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - iphone ", Ġ" iii ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - iso 9 6 6 0 - image ", Ġ" iso ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - j mol ", Ġ" j mz ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - k chart ", Ġ" ch rt ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - kill ustr ator ", Ġ" k il ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - ko an ", Ġ" sk p ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - ko an ", Ġ" sk d ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - ko an ", Ġ" sk t ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - ko an ", Ġ" sk m ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - k presenter ", Ġ" k pr ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - k presenter ", Ġ" k pt ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - k spread ", Ġ" k sp ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - k word ", Ġ" kw d ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - k word ", Ġ" kw t ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - latex ", Ġ" latex ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - l ha ", Ġ" l ha ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - l zh ", Ġ" l zh ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - l zx ", Ġ" l zx ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - maker ", Ġ" frm ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - maker ", Ġ" maker ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - maker ", Ġ" frame ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - maker ", Ġ" fb ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - maker ", Ġ" book ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - maker ", Ġ" fb doc ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - m if ", Ġ" m if ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - ms - w md ", Ġ" w md ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - ms - wm z ", Ġ" wm z ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - msi ", Ġ" msi ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - ns - proxy - auto config ", Ġ" pac ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - n wc ", Ġ" n wc ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - object ", Ġ" o ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - oz - application ", Ġ" o za ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - pem - file ", Ġ" pem ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - pkcs 1 2 ", Ġ" p 1 2 ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - pkcs 1 2 ", Ġ" p fx ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - pkcs 7 - cert req resp ", Ġ" p 7 r ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - pkcs 7 - c rl ", Ġ" c rl ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - quick time player ", Ġ" q tl ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - shar ", Ġ" shar ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - sh ock wave - flash ", Ġ" sw f ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - stuff it ", Ġ" sit ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - sv 4 cp io ", Ġ" sv 4 cp io ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - sv 4 crc ", Ġ" sv 4 crc ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - tar ", Ġ" tar ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - tex info ", Ġ" tex info ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - tex info ", Ġ" tex i ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - tro ff ", Ġ" t ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - tro ff ", Ġ" ro ff ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - tro ff - man ", Ġ" man ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - ust ar ", Ġ" ust ar ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - wa is - source ", Ġ" src ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - wing z ", Ġ" wz ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - web archive ", Ġ" web archive ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - web archive - xml ", Ġ" web arch iv ex ml ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - x 5 0 9 - ca - cert ", Ġ" crt ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - x 5 0 9 - user - cert ", Ġ" crt ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - x 5 0 9 - server - cert ", Ġ" crt ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - xcf ", Ġ" xcf ") čĊĠĠĠĠĠĠĠ Ġadd (" application / x - x fig ", Ġ" fig ") čĊĠĠĠĠĠĠĠ Ġadd (" application / xhtml + xml ", Ġ" xhtml ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / 3 g pp ", Ġ" 3 g pp ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / aac ", Ġ" aac ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / aac - ad ts ", Ġ" aac ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / am r ", Ġ" am r ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / am r - wb ", Ġ" aw b ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / basic ", Ġ" snd ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / ime lo dy ", Ġ" im y ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / midi ", Ġ" mid ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / midi ", Ġ" midi ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / midi ", Ġ" ota ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / midi ", Ġ" kar ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / midi ", Ġ" rt ttl ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / midi ", Ġ" x mf ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / mobile - x mf ", Ġ" mx mf ") čĊĠĠĠĠĠĠĠ Ġ// Ġadd Ġ". mp 3 " Ġfirst Ġso Ġit Ġwill Ġbe Ġthe Ġdefault Ġfor Ġguess Extension From MimeType čĊĠĠĠĠĠĠĠ Ġadd (" audio / mpeg ", Ġ" mp 3 ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / mpeg ", Ġ" mp ga ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / mpeg ", Ġ" mp e ga ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / mpeg ", Ġ" mp 2 ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / mpeg ", Ġ" m 4 a ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / mpeg url ", Ġ" m 3 u ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / prs . sid ", Ġ" sid ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - a iff ", Ġ" a if ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - a iff ", Ġ" a iff ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - a iff ", Ġ" a if c ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - g sm ", Ġ" g sm ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - mat ro ska ", Ġ" m ka ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - mpeg url ", Ġ" m 3 u ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - ms - w ma ", Ġ" w ma ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - ms - w ax ", Ġ" w ax ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - pn - real audio ", Ġ" ra ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - pn - real audio ", Ġ" rm ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - pn - real audio ", Ġ" ram ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - real audio ", Ġ" ra ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - sc pl s ", Ġ" pl s ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - sd 2 ", Ġ" sd 2 ") čĊĠĠĠĠĠĠĠ Ġadd (" audio / x - wav ", Ġ" wav ") čĊĠĠĠĠĠĠĠ Ġadd (" image / bmp ", Ġ" bmp ") čĊĠĠĠĠĠĠĠ Ġadd (" image / gif ", Ġ" gif ") čĊĠĠĠĠĠĠĠ Ġadd (" image / ico ", Ġ" cur ") čĊĠĠĠĠĠĠĠ Ġadd (" image / ico ", Ġ" ico ") čĊĠĠĠĠĠĠĠ Ġadd (" image / ief ", Ġ" ief ") čĊĠĠĠĠĠĠĠ Ġadd (" image / jpeg ", Ġ" jpeg ") čĊĠĠĠĠĠĠĠ Ġadd (" image / jpeg ", Ġ" jpg ") čĊĠĠĠĠĠĠĠ Ġadd (" image / jpeg ", Ġ" j pe ") čĊĠĠĠĠĠĠĠ Ġadd (" image / pc x ", Ġ" pc x ") čĊĠĠĠĠĠĠĠ Ġadd (" image / png ", Ġ" png ") čĊĠĠĠĠĠĠĠ Ġadd (" image / svg + xml ", Ġ" svg ") čĊĠĠĠĠĠĠĠ Ġadd (" image / svg + xml ", Ġ" svg z ") čĊĠĠĠĠĠĠĠ Ġadd (" image / tiff ", Ġ" tiff ") čĊĠĠĠĠĠĠĠ Ġadd (" image / tiff ", Ġ" tif ") čĊĠĠĠĠĠĠĠ Ġadd (" image / vnd . dj vu ", Ġ" dj vu ") čĊĠĠĠĠĠĠĠ Ġadd (" image / vnd . dj vu ", Ġ" dj v ") čĊĠĠĠĠĠĠĠ Ġadd (" image / vnd . wap . wb mp ", Ġ" wb mp ") čĊĠĠĠĠĠĠĠ Ġadd (" image / webp ", Ġ" webp ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - cm u - raster ", Ġ" ras ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - core ld raw ", Ġ" cdr ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - core ld raw pattern ", Ġ" pat ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - core ld raw template ", Ġ" cdt ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - core l phot op aint ", Ġ" cpt ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - icon ", Ġ" ico ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - jg ", Ġ" art ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - j ng ", Ġ" j ng ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - ms - bmp ", Ġ" bmp ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - photos hop ", Ġ" ps d ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - portable - any map ", Ġ" pn m ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - portable - bitmap ", Ġ" pb m ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - portable - gray map ", Ġ" pg m ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - portable - pix map ", Ġ" pp m ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - rgb ", Ġ" rgb ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - x bitmap ", Ġ" xb m ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - xp ix map ", Ġ" x pm ") čĊĠĠĠĠĠĠĠ Ġadd (" image / x - x window dump ", Ġ" x wd ") čĊĠĠĠĠĠĠĠ Ġadd (" model / i ges ", Ġ" igs ") čĊĠĠĠĠĠĠĠ Ġadd (" model / i ges ", Ġ" i ges ") čĊĠĠĠĠĠĠĠ Ġadd (" model / mesh ", Ġ" m sh ") čĊĠĠĠĠĠĠĠ Ġadd (" model / mesh ", Ġ" mesh ") čĊĠĠĠĠĠĠĠ Ġadd (" model / mesh ", Ġ" si lo ") čĊĠĠĠĠĠĠĠ Ġadd (" text / calendar ", Ġ" ics ") čĊĠĠĠĠĠĠĠ Ġadd (" text / calendar ", Ġ" ic z ") čĊĠĠĠĠĠĠĠ Ġadd (" text / comma - separated - values ", Ġ" csv ") čĊĠĠĠĠĠĠĠ Ġadd (" text / css ", Ġ" css ") čĊĠĠĠĠĠĠĠ Ġadd (" text / html ", Ġ" htm ") čĊĠĠĠĠĠĠĠ Ġadd (" text / html ", Ġ" html ") čĊĠĠĠĠĠĠĠ Ġadd (" text / h 3 2 3 ", Ġ" 3 2 3 ") čĊĠĠĠĠĠĠĠ Ġadd (" text / i uls ", Ġ" uls ") čĊĠĠĠĠĠĠĠ Ġadd (" text / math ml ", Ġ" m ml ") čĊĠĠĠĠĠĠĠ Ġ// Ġadd Ġ". txt " Ġfirst Ġso Ġit Ġwill Ġbe Ġthe Ġdefault Ġfor Ġguess Extension From MimeType čĊĠĠĠĠĠĠĠ Ġadd (" text / plain ", Ġ" txt ") čĊĠĠĠĠĠĠĠ Ġadd (" text / plain ", Ġ" asc ") čĊĠĠĠĠĠĠĠ Ġadd (" text / plain ", Ġ" text ") čĊĠĠĠĠĠĠĠ Ġadd (" text / plain ", Ġ" diff ") čĊĠĠĠĠĠĠĠ Ġadd (" text / plain ", Ġ" po ") ĠĠĠĠ Ġ// Ġreserve Ġ" pot " Ġfor Ġv nd . ms - power point čĊĠĠĠĠĠĠĠ Ġadd (" text / richt ext ", Ġ" rtx ") čĊĠĠĠĠĠĠĠ Ġadd (" text / rtf ", Ġ" rtf ") čĊĠĠĠĠĠĠĠ Ġadd (" text / tex macs ", Ġ" ts ") čĊĠĠĠĠĠĠĠ Ġadd (" text / text ", Ġ" ph ps ") čĊĠĠĠĠĠĠĠ Ġadd (" text / tab - separated - values ", Ġ" tsv ") čĊĠĠĠĠĠĠĠ Ġadd (" text / xml ", Ġ" xml ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - bib tex ", Ġ" bib ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - b oo ", Ġ" b oo ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c ++ hdr ", Ġ" hpp ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c ++ hdr ", Ġ" h ++ ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c ++ hdr ", Ġ" hxx ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c ++ hdr ", Ġ" hh ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c ++ src ", Ġ" cpp ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c ++ src ", Ġ" c ++ ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c ++ src ", Ġ" cc ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c ++ src ", Ġ" cxx ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - ch dr ", Ġ" h ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - component ", Ġ" ht c ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c sh ", Ġ" c sh ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - c src ", Ġ" c ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - d src ", Ġ" d ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - haskell ", Ġ" hs ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - java ", Ġ" java ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - l iterate - haskell ", Ġ" lhs ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - m oc ", Ġ" m oc ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - pas cal ", Ġ" p ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - pas cal ", Ġ" pas ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - pcs - gcd ", Ġ" gcd ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - set ext ", Ġ" et x ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - tcl ", Ġ" tcl ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - tex ", Ġ" tex ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - tex ", Ġ" l tx ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - tex ", Ġ" sty ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - tex ", Ġ" cls ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - v calendar ", Ġ" vcs ") čĊĠĠĠĠĠĠĠ Ġadd (" text / x - v card ", Ġ" vcf ") čĊĠĠĠĠĠĠĠ Ġadd (" video / 3 g pp ", Ġ" 3 g pp ") čĊĠĠĠĠĠĠĠ Ġadd (" video / 3 g pp ", Ġ" 3 gp ") čĊĠĠĠĠĠĠĠ Ġadd (" video / 3 g pp 2 ", Ġ" 3 g pp 2 ") čĊĠĠĠĠĠĠĠ Ġadd (" video / 3 g pp 2 ", Ġ" 3 g 2 ") čĊĠĠĠĠĠĠĠ Ġadd (" video / avi ", Ġ" avi ") čĊĠĠĠĠĠĠĠ Ġadd (" video / dl ", Ġ" dl ") čĊĠĠĠĠĠĠĠ Ġadd (" video / dv ", Ġ" dif ") čĊĠĠĠĠĠĠĠ Ġadd (" video / dv ", Ġ" dv ") čĊĠĠĠĠĠĠĠ Ġadd (" video / f li ", Ġ" f li ") čĊĠĠĠĠĠĠĠ Ġadd (" video / m 4 v ", Ġ" m 4 v ") čĊĠĠĠĠĠĠĠ Ġadd (" video / mp 2 ts ", Ġ" ts ") čĊĠĠĠĠĠĠĠ Ġadd (" video / mpeg ", Ġ" mpeg ") čĊĠĠĠĠĠĠĠ Ġadd (" video / mpeg ", Ġ" mp g ") čĊĠĠĠĠĠĠĠ Ġadd (" video / mpeg ", Ġ" mp e ") čĊĠĠĠĠĠĠĠ Ġadd (" video / mp 4 ", Ġ" mp 4 ") čĊĠĠĠĠĠĠĠ Ġadd (" video / mpeg ", Ġ" V OB ") čĊĠĠĠĠĠĠĠ Ġadd (" video / quick time ", Ġ" qt ") čĊĠĠĠĠĠĠĠ Ġadd (" video / quick time ", Ġ" mov ") čĊĠĠĠĠĠĠĠ Ġadd (" video / vnd . mpeg url ", Ġ" mx u ") čĊĠĠĠĠĠĠĠ Ġadd (" video / web m ", Ġ" web m ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - la - as f ", Ġ" ls f ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - la - as f ", Ġ" ls x ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - mat ro ska ", Ġ" mk v ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - m ng ", Ġ" m ng ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - ms - as f ", Ġ" as f ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - ms - as f ", Ġ" as x ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - ms - wm ", Ġ" wm ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - ms - w mv ", Ġ" w mv ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - ms - w mx ", Ġ" w mx ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - ms - w vx ", Ġ" w vx ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - sgi - movie ", Ġ" movie ") čĊĠĠĠĠĠĠĠ Ġadd (" video / x - web ex ", Ġ" w rf ") čĊĠĠĠĠĠĠĠ Ġadd (" x - conference / x - co olt alk ", Ġ" ice ") čĊĠĠĠĠĠĠĠ Ġadd (" x - ep oc / x - sis x - app ", Ġ" sis x ") čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ/** čĊĠĠĠĠ Ġ* Ġ@ param ĠmimeType čĊĠĠĠĠ Ġ* Ġ@ param Ġextension čĊĠĠĠĠ Ġ*/ čĊĠĠĠ Ġprivate Ġfun Ġadd (@ Size ( min Ġ= Ġ 1 ) ĠmimeType : ĠString , Ġ@ Size ( min Ġ= Ġ 1 ) Ġextension : ĠString ) Ġ{ čĊĠĠĠĠĠĠĠ Ġif Ġ(! mime Type To Extension Map . containsKey ( mime Type )) Ġ{ čĊĠĠĠĠĠĠĠĠĠĠĠ ĠmimeType To Extension Map [ mime Type ] Ġ= Ġextension čĊĠĠĠĠĠĠĠ Ġ} čĊĠĠĠĠĠĠĠ Ġextension To MimeType Map [ extension ] Ġ= ĠmimeType čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġfun ĠgetFile Extension From Url ( url : ĠString ): ĠString Ġ{ čĊĠĠĠĠĠĠĠ Ġvar Ġurl Ġ= Ġurl čĊĠĠĠĠĠĠĠ Ġif Ġ( url . isNotEmpty ()) Ġ{ čĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfragment Ġ= Ġurl . lastIndexOf ('# ') čĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( fragment Ġ> Ġ 0 ) Ġ{ čĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġurl Ġ= Ġurl . substring ( 0 , Ġfragment ) čĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} čĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġquery Ġ= Ġurl . lastIndexOf (' ?') čĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( query Ġ> Ġ 0 ) Ġ{ čĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġurl Ġ= Ġurl . substring ( 0 , Ġquery ) čĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} čĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfilename Pos Ġ= Ġurl . lastIndexOf ('/') čĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfilename Ġ= Ġif Ġ( 0 Ġ<= Ġfilename Pos ) Ġurl . substring ( filename Pos Ġ+ Ġ 1 ) Ġelse Ġurl čĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ(! filename . isEmpty () Ġ&& ĠPattern . matches ("[ a - zA - Z _ 0 - 9 \\. \\ - \\ (\\ )\\ % ]+ ", Ġfilename )) Ġ{ čĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdot Pos Ġ= Ġfilename . lastIndexOf ('.') čĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( 0 Ġ<= Ġdot Pos ) Ġ{ čĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġfilename . substring ( dot Pos Ġ+ Ġ 1 ) čĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} čĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} čĊĠĠĠĠĠĠĠ Ġ} čĊĠĠĠĠĠĠĠ Ġreturn Ġ"" čĊĠĠĠ Ġ} čĊčĊčĊĠĠĠ Ġ/** čĊĠĠĠĠ Ġ* Ġ@ param ĠmimeType čĊĠĠĠĠ Ġ* Ġ@ return čĊĠĠĠĠ Ġ*/ čĊĠĠĠ Ġfun Ġhas MimeType (@ Size ( min Ġ= Ġ 1 ) ĠmimeType : ĠString ): ĠBoolean Ġ{ čĊĠĠĠĠĠĠĠ Ġreturn ĠmimeType To Extension Map . containsKey ( mime Type ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ/** čĊĠĠĠĠ Ġ* Ġ@ param Ġextension čĊĠĠĠĠ Ġ* Ġ@ return čĊĠĠĠĠ Ġ*/ čĊĠĠĠ Ġfun Ġguess MimeType From Extension (@ Size ( min Ġ= Ġ 1 ) Ġextension : ĠString ): ĠString ? Ġ{ čĊĠĠĠĠĠĠĠ Ġreturn Ġextension To MimeType Map [ extension ] čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ/** čĊĠĠĠĠ Ġ* Ġ@ param Ġextension čĊĠĠĠĠ Ġ* Ġ@ return čĊĠĠĠĠ Ġ*/ čĊĠĠĠ Ġfun Ġhas Extension (@ Size ( min Ġ= Ġ 1 ) Ġextension : ĠString ): ĠBoolean Ġ{ čĊĠĠĠĠĠĠĠ Ġreturn Ġextension To MimeType Map . containsKey ( extension ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ/** čĊĠĠĠĠ Ġ* Ġ@ param ĠmimeType čĊĠĠĠĠ Ġ* Ġ@ return čĊĠĠĠĠ Ġ*/ čĊĠĠĠ Ġfun Ġguess Extension From MimeType (@ Size ( min Ġ= Ġ 1 ) ĠmimeType : ĠString ): ĠString ? Ġ{ čĊĠĠĠĠĠĠĠ Ġreturn ĠmimeType To Extension Map [ mime Type ] čĊĠĠĠ Ġ} č Ċ }