1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-15 14:05:05 -05:00
k-9/src/com/fsck/k9/mail/Part.java
2014-12-15 12:42:05 +01:00

56 lines
1.8 KiB
Java

package com.fsck.k9.mail;
import java.io.IOException;
import java.io.OutputStream;
public interface Part {
void addHeader(String name, String value) throws MessagingException;
void removeHeader(String name) throws MessagingException;
void setHeader(String name, String value) throws MessagingException;
Body getBody();
String getContentType() throws MessagingException;
String getDisposition() throws MessagingException;
String getContentId() throws MessagingException;
String[] getHeader(String name) throws MessagingException;
boolean isMimeType(String mimeType) throws MessagingException;
String getMimeType() throws MessagingException;
void setBody(Body body) throws MessagingException;
void writeTo(OutputStream out) throws IOException, MessagingException;
/**
* Reads the Part's body and returns a String based on any charset conversion that needed
* to be done. Note, this <b>does not</b> return a text representation of HTML.
* @return a String containing the converted text in the body, or null if there was no text
* or an error during conversion.
*/
String getText();
Part findFirstPartByMimeType(String mimeType) throws MessagingException;
/**
* Called just prior to transmission, once the type of transport is known to
* be 7bit.
* <p>
* All bodies that are 8bit will be converted to 7bit and recursed if of
* type {@link CompositeBody}, or will be converted to quoted-printable in all other
* cases. Bodies with encodings other than 8bit remain unchanged.
*
* @throws MessagingException
*
*/
//TODO perhaps it would be clearer to use a flag "force7bit" in writeTo
void setUsing7bitTransport() throws MessagingException;
}