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.stream; |
---|
21 | |
---|
22 | import java.util.Map; |
---|
23 | |
---|
24 | /** |
---|
25 | * Represents common content properties. |
---|
26 | */ |
---|
27 | public interface ContentDescriptor { |
---|
28 | |
---|
29 | /** |
---|
30 | * Returns the body descriptors MIME type. |
---|
31 | * @see #getMediaType() |
---|
32 | * @see #getSubType() |
---|
33 | * @return The MIME type, which has been parsed from the |
---|
34 | * content-type definition. Must not be null, but |
---|
35 | * "text/plain", if no content-type was specified. |
---|
36 | */ |
---|
37 | String getMimeType(); |
---|
38 | |
---|
39 | /** |
---|
40 | * Gets the defaulted MIME media type for this content. |
---|
41 | * For example <code>TEXT</code>, <code>IMAGE</code>, <code>MULTIPART</code> |
---|
42 | * @see #getMimeType() |
---|
43 | * @return the MIME media type when content-type specified, |
---|
44 | * otherwise the correct default (<code>TEXT</code>) |
---|
45 | */ |
---|
46 | String getMediaType(); |
---|
47 | |
---|
48 | /** |
---|
49 | * Gets the defaulted MIME sub type for this content. |
---|
50 | * @see #getMimeType() |
---|
51 | * @return the MIME media type when content-type is specified, |
---|
52 | * otherwise the correct default (<code>PLAIN</code>) |
---|
53 | */ |
---|
54 | String getSubType(); |
---|
55 | |
---|
56 | /** |
---|
57 | * <p>The body descriptors character set, defaulted appropriately for the MIME type.</p> |
---|
58 | * <p> |
---|
59 | * For <code>TEXT</code> types, this will be defaulted to <code>us-ascii</code>. |
---|
60 | * For other types, when the charset parameter is missing this property will be null. |
---|
61 | * </p> |
---|
62 | * @return Character set, which has been parsed from the |
---|
63 | * content-type definition. Not null for <code>TEXT</code> types, when unset will |
---|
64 | * be set to default <code>us-ascii</code>. For other types, when unset, |
---|
65 | * null will be returned. |
---|
66 | */ |
---|
67 | String getCharset(); |
---|
68 | |
---|
69 | /** |
---|
70 | * Returns the body descriptors transfer encoding. |
---|
71 | * @return The transfer encoding. Must not be null, but "7bit", |
---|
72 | * if no transfer-encoding was specified. |
---|
73 | */ |
---|
74 | String getTransferEncoding(); |
---|
75 | |
---|
76 | /** |
---|
77 | * Returns the map of parameters of the content-type header. |
---|
78 | */ |
---|
79 | Map<String, String> getContentTypeParameters(); |
---|
80 | |
---|
81 | /** |
---|
82 | * Returns the body descriptors content-length. |
---|
83 | * @return Content length, if known, or -1, to indicate the absence of a |
---|
84 | * content-length header. |
---|
85 | */ |
---|
86 | long getContentLength(); |
---|
87 | |
---|
88 | } |
---|