1 /**
2 *
3 * Copyright 2003-2004 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 package javax.mail;
19
20 import java.io.IOException;
21 import java.io.InputStream;
22 import java.io.OutputStream;
23 import java.util.Enumeration;
24 import javax.activation.DataHandler;
25
26 /**
27 * Note: Parts are used in Collections so implementing classes must provide
28 * a suitable implementation of equals and hashCode.
29 *
30 * @version $Rev: 128416 $ $Date: 2005-01-27 11:46:59 -0800 (Thu, 27 Jan 2005) $
31 */
32 public interface Part {
33 public static final String ATTACHMENT = "attachment";
34 public static final String INLINE = "inline";
35
36 public abstract void addHeader(String name, String value) throws MessagingException;
37
38 public abstract Enumeration getAllHeaders() throws MessagingException;
39
40 public abstract Object getContent() throws IOException, MessagingException;
41
42 public abstract String getContentType() throws MessagingException;
43
44 public abstract DataHandler getDataHandler() throws MessagingException;
45
46 public abstract String getDescription() throws MessagingException;
47
48 public abstract String getDisposition() throws MessagingException;
49
50 public abstract String getFileName() throws MessagingException;
51
52 public abstract String[] getHeader(String name) throws MessagingException;
53
54 public abstract InputStream getInputStream() throws IOException, MessagingException;
55
56 public abstract int getLineCount() throws MessagingException;
57
58 public abstract Enumeration getMatchingHeaders(String[] names) throws MessagingException;
59
60 public abstract Enumeration getNonMatchingHeaders(String[] names) throws MessagingException;
61
62 public abstract int getSize() throws MessagingException;
63
64 public abstract boolean isMimeType(String mimeType) throws MessagingException;
65
66 public abstract void removeHeader(String name) throws MessagingException;
67
68 public abstract void setContent(Multipart content) throws MessagingException;
69
70 public abstract void setContent(Object content, String type) throws MessagingException;
71
72 public abstract void setDataHandler(DataHandler handler) throws MessagingException;
73
74 public abstract void setDescription(String description) throws MessagingException;
75
76 public abstract void setDisposition(String disposition) throws MessagingException;
77
78 public abstract void setFileName(String name) throws MessagingException;
79
80 public abstract void setHeader(String name, String value) throws MessagingException;
81
82 public abstract void setText(String content) throws MessagingException;
83
84 public abstract void writeTo(OutputStream out) throws IOException, MessagingException;
85 }