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