8
8
9
9
public class MimeTypeUtil {
10
10
public static final String DEFAULT_ATTACHMENT_MIME_TYPE = "application/octet-stream" ;
11
+ public static final String PLAIN_TEXT_MIME_TYPE = "text/plain" ;
11
12
public static final String K9_SETTINGS_MIME_TYPE = "application/x-k9settings" ;
12
13
13
14
/*
@@ -19,7 +20,7 @@ public class MimeTypeUtil {
19
20
//* Do not delete the next three lines
20
21
{ "" , DEFAULT_ATTACHMENT_MIME_TYPE },
21
22
{ "k9s" , K9_SETTINGS_MIME_TYPE },
22
- { "txt" , "text/plain" },
23
+ { "txt" , PLAIN_TEXT_MIME_TYPE },
23
24
//* Do not delete the previous three lines
24
25
{ "123" , "application/vnd.lotus-1-2-3" },
25
26
{ "323" , "text/h323" },
@@ -68,7 +69,7 @@ public class MimeTypeUtil {
68
69
{ "azf" , "application/vnd.airzip.filesecure.azf" },
69
70
{ "azs" , "application/vnd.airzip.filesecure.azs" },
70
71
{ "azw" , "application/vnd.amazon.ebook" },
71
- { "bas" , "text/plain" },
72
+ { "bas" , PLAIN_TEXT_MIME_TYPE },
72
73
{ "bat" , "application/x-msdownload" },
73
74
{ "bcpio" , "application/x-bcpio" },
74
75
{ "bdf" , "application/x-font-bdf" },
@@ -123,7 +124,7 @@ public class MimeTypeUtil {
123
124
{ "cmx" , "image/x-cmx" },
124
125
{ "cod" , "application/vnd.rim.cod" },
125
126
{ "com" , "application/x-msdownload" },
126
- { "conf" , "text/plain" },
127
+ { "conf" , PLAIN_TEXT_MIME_TYPE },
127
128
{ "cpio" , "application/x-cpio" },
128
129
{ "cpp" , "text/x-c" },
129
130
{ "cpt" , "application/mac-compactpro" },
@@ -136,7 +137,7 @@ public class MimeTypeUtil {
136
137
{ "css" , "text/css" },
137
138
{ "cst" , "application/x-director" },
138
139
{ "csv" , "text/csv" },
139
- { "c" , "text/plain" },
140
+ { "c" , PLAIN_TEXT_MIME_TYPE },
140
141
{ "cu" , "application/cu-seeme" },
141
142
{ "curl" , "text/vnd.curl" },
142
143
{ "cww" , "application/prs.cww" },
@@ -150,12 +151,12 @@ public class MimeTypeUtil {
150
151
{ "dd2" , "application/vnd.oma.dd2+xml" },
151
152
{ "ddd" , "application/vnd.fujixerox.ddd" },
152
153
{ "deb" , "application/x-debian-package" },
153
- { "def" , "text/plain" },
154
+ { "def" , PLAIN_TEXT_MIME_TYPE },
154
155
{ "deploy" , "application/octet-stream" },
155
156
{ "der" , "application/x-x509-ca-cert" },
156
157
{ "dfac" , "application/vnd.dreamfactory" },
157
158
{ "dic" , "text/x-c" },
158
- { "diff" , "text/plain" },
159
+ { "diff" , PLAIN_TEXT_MIME_TYPE },
159
160
{ "dir" , "application/x-director" },
160
161
{ "dis" , "application/vnd.mobius.dis" },
161
162
{ "dist" , "application/octet-stream" },
@@ -284,7 +285,7 @@ public class MimeTypeUtil {
284
285
{ "hqx" , "application/mac-binhex40" },
285
286
{ "hta" , "application/hta" },
286
287
{ "htc" , "text/x-component" },
287
- { "h" , "text/plain" },
288
+ { "h" , PLAIN_TEXT_MIME_TYPE },
288
289
{ "htke" , "application/vnd.kenameaapp" },
289
290
{ "html" , "text/html" },
290
291
{ "htm" , "text/html" },
@@ -309,7 +310,7 @@ public class MimeTypeUtil {
309
310
{ "imp" , "application/vnd.accpac.simply.imp" },
310
311
{ "ims" , "application/vnd.ms-ims" },
311
312
{ "ins" , "application/x-internet-signup" },
312
- { "in" , "text/plain" },
313
+ { "in" , PLAIN_TEXT_MIME_TYPE },
313
314
{ "ipk" , "application/vnd.shana.informed.package" },
314
315
{ "irm" , "application/vnd.ibm.rights-management" },
315
316
{ "irp" , "application/vnd.irepository.package+xml" },
@@ -347,7 +348,7 @@ public class MimeTypeUtil {
347
348
{ "kon" , "application/vnd.kde.kontour" },
348
349
{ "kpr" , "application/vnd.kde.kpresenter" },
349
350
{ "kpt" , "application/vnd.kde.kpresenter" },
350
- { "ksh" , "text/plain" },
351
+ { "ksh" , PLAIN_TEXT_MIME_TYPE },
351
352
{ "ksp" , "application/vnd.kde.kspread" },
352
353
{ "ktr" , "application/vnd.kahootz" },
353
354
{ "ktz" , "application/vnd.kahootz" },
@@ -361,8 +362,8 @@ public class MimeTypeUtil {
361
362
{ "link66" , "application/vnd.route66.link66+xml" },
362
363
{ "list3820" , "application/vnd.ibm.modcap" },
363
364
{ "listafp" , "application/vnd.ibm.modcap" },
364
- { "list" , "text/plain" },
365
- { "log" , "text/plain" },
365
+ { "list" , PLAIN_TEXT_MIME_TYPE },
366
+ { "log" , PLAIN_TEXT_MIME_TYPE },
366
367
{ "lostxml" , "application/lost+xml" },
367
368
{ "lrf" , "application/octet-stream" },
368
369
{ "lrm" , "application/vnd.ms-lrm" },
@@ -542,7 +543,7 @@ public class MimeTypeUtil {
542
543
{ "plc" , "application/vnd.mobius.plc" },
543
544
{ "plf" , "application/vnd.pocketlearn" },
544
545
{ "pls" , "application/pls+xml" },
545
- { "pl" , "text/plain" },
546
+ { "pl" , PLAIN_TEXT_MIME_TYPE },
546
547
{ "pma" , "application/x-perfmon" },
547
548
{ "pmc" , "application/x-perfmon" },
548
549
{ "pml" , "application/x-perfmon" },
@@ -727,7 +728,7 @@ public class MimeTypeUtil {
727
728
{ "tex" , "application/x-tex" },
728
729
{ "texi" , "application/x-texinfo" },
729
730
{ "texinfo" , "application/x-texinfo" },
730
- { "text" , "text/plain" },
731
+ { "text" , PLAIN_TEXT_MIME_TYPE },
731
732
{ "tfm" , "application/x-tex-tfm" },
732
733
{ "tgz" , "application/x-gzip" },
733
734
{ "tiff" , "image/tiff" },
@@ -746,7 +747,7 @@ public class MimeTypeUtil {
746
747
{ "twds" , "application/vnd.simtech-mindmapper" },
747
748
{ "txd" , "application/vnd.genomatix.tuxedo" },
748
749
{ "txf" , "application/vnd.mobius.txf" },
749
- { "txt" , "text/plain" },
750
+ { "txt" , PLAIN_TEXT_MIME_TYPE },
750
751
{ "u32" , "application/x-authorware-bin" },
751
752
{ "udeb" , "application/x-debian-package" },
752
753
{ "ufd" , "application/vnd.ufdl" },
@@ -872,7 +873,8 @@ public class MimeTypeUtil {
872
873
};
873
874
874
875
public static boolean isDefaultMimeType (String mimeType ) {
875
- return isSameMimeType (mimeType , DEFAULT_ATTACHMENT_MIME_TYPE );
876
+ return isSameMimeType (mimeType , DEFAULT_ATTACHMENT_MIME_TYPE ) ||
877
+ isSameMimeType (mimeType , PLAIN_TEXT_MIME_TYPE );
876
878
}
877
879
878
880
public static String getMimeTypeByExtension (String filename ) {
0 commit comments