Methods Summary |
---|
public void | addHeader(java.lang.String name, java.lang.String value)
mHeader.addHeader(name, value);
|
public com.android.email.mail.Body | getBody()
return mBody;
|
public java.lang.String | getContentId()
String contentId = getFirstHeader(MimeHeader.HEADER_CONTENT_ID);
if (contentId == null) {
return null;
} else {
// remove optionally surrounding brackets.
return REMOVE_OPTIONAL_BRACKETS.matcher(contentId).replaceAll("$1");
}
|
public java.lang.String | getContentType()
String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE);
if (contentType == null) {
return "text/plain";
} else {
return contentType;
}
|
public java.lang.String | getDisposition()
String contentDisposition = getFirstHeader(MimeHeader.HEADER_CONTENT_DISPOSITION);
if (contentDisposition == null) {
return null;
} else {
return contentDisposition;
}
|
protected java.lang.String | getFirstHeader(java.lang.String name)
return mHeader.getFirstHeader(name);
|
public java.lang.String[] | getHeader(java.lang.String name)
return mHeader.getHeader(name);
|
public java.lang.String | getMimeType()
return MimeUtility.getHeaderParameter(getContentType(), null);
|
public int | getSize()
return mSize;
|
public boolean | isMimeType(java.lang.String mimeType)
return getMimeType().equals(mimeType);
|
public void | removeHeader(java.lang.String name)
mHeader.removeHeader(name);
|
public void | setBody(com.android.email.mail.Body body)
this.mBody = body;
if (body instanceof com.android.email.mail.Multipart) {
com.android.email.mail.Multipart multipart = ((com.android.email.mail.Multipart)body);
multipart.setParent(this);
setHeader(MimeHeader.HEADER_CONTENT_TYPE, multipart.getContentType());
}
else if (body instanceof TextBody) {
String contentType = String.format("%s;\n charset=utf-8", getMimeType());
String name = MimeUtility.getHeaderParameter(getContentType(), "name");
if (name != null) {
contentType += String.format(";\n name=\"%s\"", name);
}
setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType);
setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
}
|
public void | setHeader(java.lang.String name, java.lang.String value)
mHeader.setHeader(name, value);
|
public void | writeTo(java.io.OutputStream out)Write the MimeMessage out in MIME format.
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
mHeader.writeTo(out);
writer.write("\r\n");
writer.flush();
if (mBody != null) {
mBody.writeTo(out);
}
|