001 /** 002 * 003 * Copyright 2003-2004 The Apache Software Foundation 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package javax.mail; 019 020 import java.io.IOException; 021 import java.io.InputStream; 022 import java.io.OutputStream; 023 import java.util.Enumeration; 024 import javax.activation.DataHandler; 025 026 /** 027 * Note: Parts are used in Collections so implementing classes must provide 028 * a suitable implementation of equals and hashCode. 029 * 030 * @version $Rev: 128416 $ $Date: 2005-01-27 11:46:59 -0800 (Thu, 27 Jan 2005) $ 031 */ 032 public interface Part { 033 public static final String ATTACHMENT = "attachment"; 034 public static final String INLINE = "inline"; 035 036 public abstract void addHeader(String name, String value) throws MessagingException; 037 038 public abstract Enumeration getAllHeaders() throws MessagingException; 039 040 public abstract Object getContent() throws IOException, MessagingException; 041 042 public abstract String getContentType() throws MessagingException; 043 044 public abstract DataHandler getDataHandler() throws MessagingException; 045 046 public abstract String getDescription() throws MessagingException; 047 048 public abstract String getDisposition() throws MessagingException; 049 050 public abstract String getFileName() throws MessagingException; 051 052 public abstract String[] getHeader(String name) throws MessagingException; 053 054 public abstract InputStream getInputStream() throws IOException, MessagingException; 055 056 public abstract int getLineCount() throws MessagingException; 057 058 public abstract Enumeration getMatchingHeaders(String[] names) throws MessagingException; 059 060 public abstract Enumeration getNonMatchingHeaders(String[] names) throws MessagingException; 061 062 public abstract int getSize() throws MessagingException; 063 064 public abstract boolean isMimeType(String mimeType) throws MessagingException; 065 066 public abstract void removeHeader(String name) throws MessagingException; 067 068 public abstract void setContent(Multipart content) throws MessagingException; 069 070 public abstract void setContent(Object content, String type) throws MessagingException; 071 072 public abstract void setDataHandler(DataHandler handler) throws MessagingException; 073 074 public abstract void setDescription(String description) throws MessagingException; 075 076 public abstract void setDisposition(String disposition) throws MessagingException; 077 078 public abstract void setFileName(String name) throws MessagingException; 079 080 public abstract void setHeader(String name, String value) throws MessagingException; 081 082 public abstract void setText(String content) throws MessagingException; 083 084 public abstract void writeTo(OutputStream out) throws IOException, MessagingException; 085 }