1526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen/*
2526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * Copyright (C) 2007-2008 Esmertec AG.
3526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * Copyright (C) 2007-2008 The Android Open Source Project
4526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen *
5526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * Licensed under the Apache License, Version 2.0 (the "License");
6526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * you may not use this file except in compliance with the License.
7526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * You may obtain a copy of the License at
8526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen *
9526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen *      http://www.apache.org/licenses/LICENSE-2.0
10526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen *
11526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * Unless required by applicable law or agreed to in writing, software
12526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * distributed under the License is distributed on an "AS IS" BASIS,
13526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * See the License for the specific language governing permissions and
15526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * limitations under the License.
16526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen */
17526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
18526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wenpackage com.google.android.mms;
19526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
20526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wenimport java.util.ArrayList;
21526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
22526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wenpublic class ContentType {
23526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String MMS_MESSAGE       = "application/vnd.wap.mms-message";
24526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    // The phony content type for generic PDUs (e.g. ReadOrig.ind,
25526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    // Notification.ind, Delivery.ind).
26526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String MMS_GENERIC       = "application/vnd.wap.mms-generic";
27526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String MULTIPART_MIXED   = "application/vnd.wap.multipart.mixed";
28526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String MULTIPART_RELATED = "application/vnd.wap.multipart.related";
29526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String MULTIPART_ALTERNATIVE = "application/vnd.wap.multipart.alternative";
30526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
31526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String TEXT_PLAIN        = "text/plain";
32526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String TEXT_HTML         = "text/html";
33526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String TEXT_VCALENDAR    = "text/x-vCalendar";
34526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String TEXT_VCARD        = "text/x-vCard";
35526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
36526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String IMAGE_UNSPECIFIED = "image/*";
37526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String IMAGE_JPEG        = "image/jpeg";
38526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String IMAGE_JPG         = "image/jpg";
39526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String IMAGE_GIF         = "image/gif";
40526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String IMAGE_WBMP        = "image/vnd.wap.wbmp";
41526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String IMAGE_PNG         = "image/png";
42526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String IMAGE_X_MS_BMP    = "image/x-ms-bmp";
43526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
44526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_UNSPECIFIED = "audio/*";
45526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_AAC         = "audio/aac";
46526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_AMR         = "audio/amr";
47526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_IMELODY     = "audio/imelody";
48526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_MID         = "audio/mid";
49526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_MIDI        = "audio/midi";
50526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_MP3         = "audio/mp3";
51526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_MPEG3       = "audio/mpeg3";
52526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_MPEG        = "audio/mpeg";
53526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_MPG         = "audio/mpg";
54526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_MP4         = "audio/mp4";
55526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_X_MID       = "audio/x-mid";
56526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_X_MIDI      = "audio/x-midi";
57526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_X_MP3       = "audio/x-mp3";
58526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_X_MPEG3     = "audio/x-mpeg3";
59526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_X_MPEG      = "audio/x-mpeg";
60526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_X_MPG       = "audio/x-mpg";
61526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_3GPP        = "audio/3gpp";
62526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_X_WAV       = "audio/x-wav";
63526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String AUDIO_OGG         = "application/ogg";
64526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
65526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String VIDEO_UNSPECIFIED = "video/*";
66526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String VIDEO_3GPP        = "video/3gpp";
67526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String VIDEO_3G2         = "video/3gpp2";
68526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String VIDEO_H263        = "video/h263";
69526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String VIDEO_MP4         = "video/mp4";
70526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
71526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String APP_SMIL          = "application/smil";
72526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String APP_WAP_XHTML     = "application/vnd.wap.xhtml+xml";
73526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String APP_XHTML         = "application/xhtml+xml";
74526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
75526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String APP_DRM_CONTENT   = "application/vnd.oma.drm.content";
76526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static final String APP_DRM_MESSAGE   = "application/vnd.oma.drm.message";
77526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
78526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    private static final ArrayList<String> sSupportedContentTypes = new ArrayList<String>();
79526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    private static final ArrayList<String> sSupportedImageTypes = new ArrayList<String>();
80526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    private static final ArrayList<String> sSupportedAudioTypes = new ArrayList<String>();
81526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    private static final ArrayList<String> sSupportedVideoTypes = new ArrayList<String>();
82526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
83526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    static {
84526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(TEXT_PLAIN);
85526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(TEXT_HTML);
86526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(TEXT_VCALENDAR);
87526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(TEXT_VCARD);
88526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
89526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(IMAGE_JPEG);
90526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(IMAGE_GIF);
91526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(IMAGE_WBMP);
92526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(IMAGE_PNG);
93526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(IMAGE_JPG);
94526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(IMAGE_X_MS_BMP);
95526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        //supportedContentTypes.add(IMAGE_SVG); not yet supported.
96526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
97526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_AAC);
98526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_AMR);
99526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_IMELODY);
100526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_MID);
101526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_MIDI);
102526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_MP3);
103526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_MP4);
104526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_MPEG3);
105526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_MPEG);
106526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_MPG);
107526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_X_MID);
108526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_X_MIDI);
109526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_X_MP3);
110526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_X_MPEG3);
111526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_X_MPEG);
112526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_X_MPG);
113526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_X_WAV);
114526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_3GPP);
115526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(AUDIO_OGG);
116526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
117526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(VIDEO_3GPP);
118526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(VIDEO_3G2);
119526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(VIDEO_H263);
120526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(VIDEO_MP4);
121526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
122526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(APP_SMIL);
123526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(APP_WAP_XHTML);
124526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(APP_XHTML);
125526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
126526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(APP_DRM_CONTENT);
127526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedContentTypes.add(APP_DRM_MESSAGE);
128526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
129526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        // add supported image types
130526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedImageTypes.add(IMAGE_JPEG);
131526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedImageTypes.add(IMAGE_GIF);
132526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedImageTypes.add(IMAGE_WBMP);
133526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedImageTypes.add(IMAGE_PNG);
134526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedImageTypes.add(IMAGE_JPG);
135526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedImageTypes.add(IMAGE_X_MS_BMP);
136526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
137526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        // add supported audio types
138526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_AAC);
139526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_AMR);
140526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_IMELODY);
141526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_MID);
142526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_MIDI);
143526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_MP3);
144526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_MPEG3);
145526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_MPEG);
146526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_MPG);
147526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_MP4);
148526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_X_MID);
149526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_X_MIDI);
150526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_X_MP3);
151526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_X_MPEG3);
152526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_X_MPEG);
153526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_X_MPG);
154526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_X_WAV);
155526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_3GPP);
156526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedAudioTypes.add(AUDIO_OGG);
157526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
158526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        // add supported video types
159526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedVideoTypes.add(VIDEO_3GPP);
160526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedVideoTypes.add(VIDEO_3G2);
161526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedVideoTypes.add(VIDEO_H263);
162526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        sSupportedVideoTypes.add(VIDEO_MP4);
163526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
164526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
165526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    // This class should never be instantiated.
166526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    private ContentType() {
167526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
168526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
169526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isSupportedType(String contentType) {
170526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (null != contentType) && sSupportedContentTypes.contains(contentType);
171526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
172526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
173526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isSupportedImageType(String contentType) {
174526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return isImageType(contentType) && isSupportedType(contentType);
175526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
176526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
177526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isSupportedAudioType(String contentType) {
178526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return isAudioType(contentType) && isSupportedType(contentType);
179526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
180526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
181526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isSupportedVideoType(String contentType) {
182526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return isVideoType(contentType) && isSupportedType(contentType);
183526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
184526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
185526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isTextType(String contentType) {
186526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (null != contentType) && contentType.startsWith("text/");
187526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
188526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
189526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isImageType(String contentType) {
190526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (null != contentType) && contentType.startsWith("image/");
191526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
192526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
193526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isAudioType(String contentType) {
194526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (null != contentType) && contentType.startsWith("audio/");
195526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
196526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
197526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isVideoType(String contentType) {
198526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (null != contentType) && contentType.startsWith("video/");
199526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
200526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
201526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isDrmType(String contentType) {
202526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (null != contentType)
203526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen                && (contentType.equals(APP_DRM_CONTENT)
204526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen                        || contentType.equals(APP_DRM_MESSAGE));
205526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
206526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
207526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static boolean isUnspecified(String contentType) {
208526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (null != contentType) && contentType.endsWith("*");
209526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
210526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
211526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    @SuppressWarnings("unchecked")
212526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static ArrayList<String> getImageTypes() {
213526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (ArrayList<String>) sSupportedImageTypes.clone();
214526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
215526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
216526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    @SuppressWarnings("unchecked")
217526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static ArrayList<String> getAudioTypes() {
218526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (ArrayList<String>) sSupportedAudioTypes.clone();
219526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
220526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
221526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    @SuppressWarnings("unchecked")
222526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static ArrayList<String> getVideoTypes() {
223526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (ArrayList<String>) sSupportedVideoTypes.clone();
224526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
225526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
226526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    @SuppressWarnings("unchecked")
227526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public static ArrayList<String> getSupportedTypes() {
228526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return (ArrayList<String>) sSupportedContentTypes.clone();
229526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
230526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen}
231