1 | /**************************************************************** |
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one * |
---|
3 | * or more contributor license agreements. See the NOTICE file * |
---|
4 | * distributed with this work for additional information * |
---|
5 | * regarding copyright ownership. The ASF licenses this file * |
---|
6 | * to you under the Apache License, Version 2.0 (the * |
---|
7 | * "License"); you may not use this file except in compliance * |
---|
8 | * with the License. You may obtain a copy of the License at * |
---|
9 | * * |
---|
10 | * http://www.apache.org/licenses/LICENSE-2.0 * |
---|
11 | * * |
---|
12 | * Unless required by applicable law or agreed to in writing, * |
---|
13 | * software distributed under the License is distributed on an * |
---|
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * |
---|
15 | * KIND, either express or implied. See the License for the * |
---|
16 | * specific language governing permissions and limitations * |
---|
17 | * under the License. * |
---|
18 | ****************************************************************/ |
---|
19 | |
---|
20 | package org.apache.james.mime4j.dom.field; |
---|
21 | |
---|
22 | import java.util.Map; |
---|
23 | |
---|
24 | public interface ContentTypeField extends ParsedField { |
---|
25 | |
---|
26 | /** The prefix of all <code>multipart</code> MIME types. */ |
---|
27 | public static final String TYPE_MULTIPART_PREFIX = "multipart/"; |
---|
28 | /** The <code>multipart/digest</code> MIME type. */ |
---|
29 | public static final String TYPE_MULTIPART_DIGEST = "multipart/digest"; |
---|
30 | /** The <code>text/plain</code> MIME type. */ |
---|
31 | public static final String TYPE_TEXT_PLAIN = "text/plain"; |
---|
32 | /** The <code>message/rfc822</code> MIME type. */ |
---|
33 | public static final String TYPE_MESSAGE_RFC822 = "message/rfc822"; |
---|
34 | /** The name of the <code>boundary</code> parameter. */ |
---|
35 | public static final String PARAM_BOUNDARY = "boundary"; |
---|
36 | /** The name of the <code>charset</code> parameter. */ |
---|
37 | public static final String PARAM_CHARSET = "charset"; |
---|
38 | |
---|
39 | /** |
---|
40 | * Gets the MIME type defined in this Content-Type field. |
---|
41 | * |
---|
42 | * @return the MIME type or an empty string if not set. |
---|
43 | */ |
---|
44 | String getMimeType(); |
---|
45 | |
---|
46 | /** |
---|
47 | * Gets the value of a parameter. Parameter names are case-insensitive. |
---|
48 | * |
---|
49 | * @param name |
---|
50 | * the name of the parameter to get. |
---|
51 | * @return the parameter value or <code>null</code> if not set. |
---|
52 | */ |
---|
53 | String getParameter(String name); |
---|
54 | |
---|
55 | /** |
---|
56 | * Gets all parameters. |
---|
57 | * |
---|
58 | * @return the parameters. |
---|
59 | */ |
---|
60 | Map<String, String> getParameters(); |
---|
61 | |
---|
62 | /** |
---|
63 | * Determines if the MIME type of this field matches the given one. |
---|
64 | * |
---|
65 | * @param mimeType |
---|
66 | * the MIME type to match against. |
---|
67 | * @return <code>true</code> if the MIME type of this field matches, |
---|
68 | * <code>false</code> otherwise. |
---|
69 | */ |
---|
70 | boolean isMimeType(String mimeType); |
---|
71 | |
---|
72 | /** |
---|
73 | * Determines if the MIME type of this field is <code>multipart/*</code>. |
---|
74 | * |
---|
75 | * @return <code>true</code> if this field is has a |
---|
76 | * <code>multipart/*</code> MIME type, <code>false</code> |
---|
77 | * otherwise. |
---|
78 | */ |
---|
79 | boolean isMultipart(); |
---|
80 | |
---|
81 | /** |
---|
82 | * Gets the value of the <code>boundary</code> parameter if set. |
---|
83 | * |
---|
84 | * @return the <code>boundary</code> parameter value or <code>null</code> |
---|
85 | * if not set. |
---|
86 | */ |
---|
87 | String getBoundary(); |
---|
88 | |
---|
89 | /** |
---|
90 | * Gets the value of the <code>charset</code> parameter if set. |
---|
91 | * |
---|
92 | * @return the <code>charset</code> parameter value or <code>null</code> |
---|
93 | * if not set. |
---|
94 | */ |
---|
95 | String getCharset(); |
---|
96 | |
---|
97 | } |
---|