public class MimeBodyPart extends BodyPart implements MimePart
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
content
This message's content (unless sourced from a SharedInputStream).
|
protected java.io.InputStream |
contentStream
If the data for this message was supplied by a
SharedInputStream
then this is another such stream representing the content of this message;
if this field is non-null, then content will be null. |
protected javax.activation.DataHandler |
dh
The
DataHandler for this Message's content. |
protected InternetHeaders |
headers
This message's headers.
|
ATTACHMENT, INLINE| Constructor and Description |
|---|
MimeBodyPart() |
MimeBodyPart(java.io.InputStream in) |
MimeBodyPart(InternetHeaders headers,
byte[] content) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(java.lang.String name,
java.lang.String value) |
void |
addHeaderLine(java.lang.String line) |
void |
attachFile(java.io.File file)
Attach a file to this body part from a File object.
|
void |
attachFile(java.lang.String file)
Attach a file to this body part from a file name.
|
java.util.Enumeration |
getAllHeaderLines() |
java.util.Enumeration |
getAllHeaders() |
java.lang.Object |
getContent() |
java.lang.String |
getContentID()
Retrieve the value of the "Content-ID" header.
|
java.lang.String[] |
getContentLanguage() |
java.lang.String |
getContentMD5() |
protected java.io.InputStream |
getContentStream() |
java.lang.String |
getContentType() |
javax.activation.DataHandler |
getDataHandler() |
java.lang.String |
getDescription() |
java.lang.String |
getDisposition()
Retrieve the message "Content-Disposition" header field.
|
java.lang.String |
getEncoding()
Retrieves the current value of the "Content-Transfer-Encoding"
header.
|
java.lang.String |
getFileName() |
java.lang.String[] |
getHeader(java.lang.String name) |
java.lang.String |
getHeader(java.lang.String name,
java.lang.String delimiter) |
java.io.InputStream |
getInputStream() |
int |
getLineCount() |
java.util.Enumeration |
getMatchingHeaderLines(java.lang.String[] names) |
java.util.Enumeration |
getMatchingHeaders(java.lang.String[] name) |
java.util.Enumeration |
getNonMatchingHeaderLines(java.lang.String[] names) |
java.util.Enumeration |
getNonMatchingHeaders(java.lang.String[] name) |
java.io.InputStream |
getRawInputStream() |
int |
getSize()
Return the content size of this message.
|
boolean |
isMimeType(java.lang.String type)
Tests to see if this message has a mime-type match with the
given type name.
|
void |
removeHeader(java.lang.String name) |
void |
saveFile(java.io.File file)
Save the body part content to a given target file.
|
void |
saveFile(java.lang.String file)
Save the body part content to a given target file.
|
void |
setContent(Multipart part) |
void |
setContent(java.lang.Object content,
java.lang.String type) |
void |
setContentID(java.lang.String cid) |
void |
setContentLanguage(java.lang.String[] languages) |
void |
setContentMD5(java.lang.String md5) |
void |
setDataHandler(javax.activation.DataHandler handler) |
void |
setDescription(java.lang.String description) |
void |
setDescription(java.lang.String description,
java.lang.String charset) |
void |
setDisposition(java.lang.String disposition)
Set a new dispostion value for the "Content-Disposition" field.
|
void |
setFileName(java.lang.String name) |
void |
setHeader(java.lang.String name,
java.lang.String value) |
void |
setText(java.lang.String text) |
void |
setText(java.lang.String text,
java.lang.String charset) |
void |
setText(java.lang.String text,
java.lang.String charset,
java.lang.String subtype) |
protected void |
updateHeaders() |
void |
writeTo(java.io.OutputStream out) |
protected javax.activation.DataHandler dh
DataHandler for this Message's content.protected byte[] content
protected java.io.InputStream contentStream
SharedInputStream
then this is another such stream representing the content of this message;
if this field is non-null, then content will be null.protected InternetHeaders headers
public MimeBodyPart()
public MimeBodyPart(java.io.InputStream in)
throws MessagingException
MessagingExceptionpublic MimeBodyPart(InternetHeaders headers, byte[] content) throws MessagingException
MessagingExceptionpublic int getSize()
throws MessagingException
getSize in interface PartMessagingExceptionpublic int getLineCount()
throws MessagingException
getLineCount in interface PartMessagingExceptionpublic java.lang.String getContentType()
throws MessagingException
getContentType in interface PartMessagingExceptionpublic boolean isMimeType(java.lang.String type)
throws MessagingException
isMimeType in interface Parttype - The tested type name.MessagingExceptionpublic java.lang.String getDisposition()
throws MessagingException
getDisposition in interface PartMessagingExceptionpublic void setDisposition(java.lang.String disposition)
throws MessagingException
setDisposition in interface Partdisposition - The new disposition value.MessagingExceptionpublic java.lang.String getEncoding()
throws MessagingException
getEncoding in interface MimePartMessagingExceptionpublic java.lang.String getContentID()
throws MessagingException
getContentID in interface MimePartMessagingExceptionpublic void setContentID(java.lang.String cid)
throws MessagingException
MessagingExceptionpublic java.lang.String getContentMD5()
throws MessagingException
getContentMD5 in interface MimePartMessagingExceptionpublic void setContentMD5(java.lang.String md5)
throws MessagingException
setContentMD5 in interface MimePartMessagingExceptionpublic java.lang.String[] getContentLanguage()
throws MessagingException
getContentLanguage in interface MimePartMessagingExceptionpublic void setContentLanguage(java.lang.String[] languages)
throws MessagingException
setContentLanguage in interface MimePartMessagingExceptionpublic java.lang.String getDescription()
throws MessagingException
getDescription in interface PartMessagingExceptionpublic void setDescription(java.lang.String description)
throws MessagingException
setDescription in interface PartMessagingExceptionpublic void setDescription(java.lang.String description,
java.lang.String charset)
throws MessagingException
MessagingExceptionpublic java.lang.String getFileName()
throws MessagingException
getFileName in interface PartMessagingExceptionpublic void setFileName(java.lang.String name)
throws MessagingException
setFileName in interface PartMessagingExceptionpublic java.io.InputStream getInputStream()
throws MessagingException,
java.io.IOException
getInputStream in interface PartMessagingExceptionjava.io.IOExceptionprotected java.io.InputStream getContentStream()
throws MessagingException
MessagingExceptionpublic java.io.InputStream getRawInputStream()
throws MessagingException
MessagingExceptionpublic javax.activation.DataHandler getDataHandler()
throws MessagingException
getDataHandler in interface PartMessagingExceptionpublic java.lang.Object getContent()
throws MessagingException,
java.io.IOException
getContent in interface PartMessagingExceptionjava.io.IOExceptionpublic void setDataHandler(javax.activation.DataHandler handler)
throws MessagingException
setDataHandler in interface PartMessagingExceptionpublic void setContent(java.lang.Object content,
java.lang.String type)
throws MessagingException
setContent in interface PartMessagingExceptionpublic void setText(java.lang.String text)
throws MessagingException
setText in interface MimePartsetText in interface PartMessagingExceptionpublic void setText(java.lang.String text,
java.lang.String charset)
throws MessagingException
setText in interface MimePartMessagingExceptionpublic void setText(java.lang.String text,
java.lang.String charset,
java.lang.String subtype)
throws MessagingException
setText in interface MimePartMessagingExceptionpublic void setContent(Multipart part) throws MessagingException
setContent in interface PartMessagingExceptionpublic void writeTo(java.io.OutputStream out)
throws java.io.IOException,
MessagingException
writeTo in interface Partjava.io.IOExceptionMessagingExceptionpublic java.lang.String[] getHeader(java.lang.String name)
throws MessagingException
getHeader in interface PartMessagingExceptionpublic java.lang.String getHeader(java.lang.String name,
java.lang.String delimiter)
throws MessagingException
getHeader in interface MimePartMessagingExceptionpublic void setHeader(java.lang.String name,
java.lang.String value)
throws MessagingException
setHeader in interface PartMessagingExceptionpublic void addHeader(java.lang.String name,
java.lang.String value)
throws MessagingException
addHeader in interface PartMessagingExceptionpublic void removeHeader(java.lang.String name)
throws MessagingException
removeHeader in interface PartMessagingExceptionpublic java.util.Enumeration getAllHeaders()
throws MessagingException
getAllHeaders in interface PartMessagingExceptionpublic java.util.Enumeration getMatchingHeaders(java.lang.String[] name)
throws MessagingException
getMatchingHeaders in interface PartMessagingExceptionpublic java.util.Enumeration getNonMatchingHeaders(java.lang.String[] name)
throws MessagingException
getNonMatchingHeaders in interface PartMessagingExceptionpublic void addHeaderLine(java.lang.String line)
throws MessagingException
addHeaderLine in interface MimePartMessagingExceptionpublic java.util.Enumeration getAllHeaderLines()
throws MessagingException
getAllHeaderLines in interface MimePartMessagingExceptionpublic java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names)
throws MessagingException
getMatchingHeaderLines in interface MimePartMessagingExceptionpublic java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names)
throws MessagingException
getNonMatchingHeaderLines in interface MimePartMessagingExceptionprotected void updateHeaders()
throws MessagingException
MessagingExceptionpublic void attachFile(java.io.File file)
throws java.io.IOException,
MessagingException
file - The source File object.java.io.IOExceptionMessagingExceptionpublic void attachFile(java.lang.String file)
throws java.io.IOException,
MessagingException
file - The source file name.java.io.IOExceptionMessagingExceptionpublic void saveFile(java.io.File file)
throws java.io.IOException,
MessagingException
file - The File object used to store the information.java.io.IOExceptionMessagingExceptionpublic void saveFile(java.lang.String file)
throws java.io.IOException,
MessagingException
file - The file name used to store the information.java.io.IOExceptionMessagingException