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.Date; |
---|
23 | import java.util.Map; |
---|
24 | |
---|
25 | public interface ContentDispositionField extends ParsedField { |
---|
26 | |
---|
27 | /** The <code>inline</code> disposition type. */ |
---|
28 | public static final String DISPOSITION_TYPE_INLINE = "inline"; |
---|
29 | /** The <code>attachment</code> disposition type. */ |
---|
30 | public static final String DISPOSITION_TYPE_ATTACHMENT = "attachment"; |
---|
31 | /** The name of the <code>filename</code> parameter. */ |
---|
32 | public static final String PARAM_FILENAME = "filename"; |
---|
33 | /** The name of the <code>creation-date</code> parameter. */ |
---|
34 | public static final String PARAM_CREATION_DATE = "creation-date"; |
---|
35 | /** The name of the <code>modification-date</code> parameter. */ |
---|
36 | public static final String PARAM_MODIFICATION_DATE = "modification-date"; |
---|
37 | /** The name of the <code>read-date</code> parameter. */ |
---|
38 | public static final String PARAM_READ_DATE = "read-date"; |
---|
39 | /** The name of the <code>size</code> parameter. */ |
---|
40 | public static final String PARAM_SIZE = "size"; |
---|
41 | |
---|
42 | /** |
---|
43 | * Gets the disposition type defined in this Content-Disposition field. |
---|
44 | * |
---|
45 | * @return the disposition type or an empty string if not set. |
---|
46 | */ |
---|
47 | String getDispositionType(); |
---|
48 | |
---|
49 | /** |
---|
50 | * Gets the value of a parameter. Parameter names are case-insensitive. |
---|
51 | * |
---|
52 | * @param name |
---|
53 | * the name of the parameter to get. |
---|
54 | * @return the parameter value or <code>null</code> if not set. |
---|
55 | */ |
---|
56 | String getParameter(String name); |
---|
57 | |
---|
58 | /** |
---|
59 | * Gets all parameters. |
---|
60 | * |
---|
61 | * @return the parameters. |
---|
62 | */ |
---|
63 | Map<String, String> getParameters(); |
---|
64 | |
---|
65 | /** |
---|
66 | * Determines if the disposition type of this field matches the given one. |
---|
67 | * |
---|
68 | * @param dispositionType |
---|
69 | * the disposition type to match against. |
---|
70 | * @return <code>true</code> if the disposition type of this field |
---|
71 | * matches, <code>false</code> otherwise. |
---|
72 | */ |
---|
73 | boolean isDispositionType(String dispositionType); |
---|
74 | |
---|
75 | /** |
---|
76 | * Return <code>true</code> if the disposition type of this field is |
---|
77 | * <i>inline</i>, <code>false</code> otherwise. |
---|
78 | * |
---|
79 | * @return <code>true</code> if the disposition type of this field is |
---|
80 | * <i>inline</i>, <code>false</code> otherwise. |
---|
81 | */ |
---|
82 | boolean isInline(); |
---|
83 | |
---|
84 | /** |
---|
85 | * Return <code>true</code> if the disposition type of this field is |
---|
86 | * <i>attachment</i>, <code>false</code> otherwise. |
---|
87 | * |
---|
88 | * @return <code>true</code> if the disposition type of this field is |
---|
89 | * <i>attachment</i>, <code>false</code> otherwise. |
---|
90 | */ |
---|
91 | public abstract boolean isAttachment(); |
---|
92 | |
---|
93 | /** |
---|
94 | * Gets the value of the <code>filename</code> parameter if set. |
---|
95 | * |
---|
96 | * @return the <code>filename</code> parameter value or <code>null</code> |
---|
97 | * if not set. |
---|
98 | */ |
---|
99 | String getFilename(); |
---|
100 | |
---|
101 | /** |
---|
102 | * Gets the value of the <code>creation-date</code> parameter if set and |
---|
103 | * valid. |
---|
104 | * |
---|
105 | * @return the <code>creation-date</code> parameter value or |
---|
106 | * <code>null</code> if not set or invalid. |
---|
107 | */ |
---|
108 | Date getCreationDate(); |
---|
109 | |
---|
110 | /** |
---|
111 | * Gets the value of the <code>modification-date</code> parameter if set |
---|
112 | * and valid. |
---|
113 | * |
---|
114 | * @return the <code>modification-date</code> parameter value or |
---|
115 | * <code>null</code> if not set or invalid. |
---|
116 | */ |
---|
117 | Date getModificationDate(); |
---|
118 | |
---|
119 | /** |
---|
120 | * Gets the value of the <code>read-date</code> parameter if set and |
---|
121 | * valid. |
---|
122 | * |
---|
123 | * @return the <code>read-date</code> parameter value or <code>null</code> |
---|
124 | * if not set or invalid. |
---|
125 | */ |
---|
126 | Date getReadDate(); |
---|
127 | |
---|
128 | /** |
---|
129 | * Gets the value of the <code>size</code> parameter if set and valid. |
---|
130 | * |
---|
131 | * @return the <code>size</code> parameter value or <code>-1</code> if |
---|
132 | * not set or invalid. |
---|
133 | */ |
---|
134 | long getSize(); |
---|
135 | |
---|
136 | } |
---|