1
2
3
4
5
6
7
8
9
10 package ch.qos.logback.core.util;
11
12
13
14
15
16
17
18 public class ContentTypeUtil {
19
20 public static boolean isTextual(String contextType) {
21 if (contextType == null) {
22 return false;
23 }
24 return contextType.startsWith("text");
25 }
26
27 public static String getSubType(String contextType) {
28 if (contextType == null) {
29 return null;
30 }
31 int index = contextType.indexOf('/');
32 if (index == -1) {
33 return null;
34 } else {
35 int subTypeStartIndex = index + 1;
36 if (subTypeStartIndex < contextType.length()) {
37 return contextType.substring(subTypeStartIndex);
38 } else {
39 return null;
40 }
41 }
42 }
43 }