|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.mail.BodyPart javax.mail.internet.MimeBodyPart
public class MimeBodyPart
Field Summary | |
---|---|
protected byte[] |
content
This message's content (unless sourced from a SharedInputStream). |
protected 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 DataHandler |
dh
The DataHandler for this Message's content. |
protected InternetHeaders |
headers
This message's headers. |
Fields inherited from class javax.mail.BodyPart |
---|
parent |
Fields inherited from interface javax.mail.Part |
---|
ATTACHMENT, INLINE |
Constructor Summary | |
---|---|
MimeBodyPart()
|
|
MimeBodyPart(InputStream in)
|
|
MimeBodyPart(InternetHeaders headers,
byte[] content)
|
Method Summary | |
---|---|
void |
addHeader(String name,
String value)
Add this value to the existing headers with the given name. |
void |
addHeaderLine(String line)
|
void |
attachFile(File file)
Attach a file to this body part from a File object. |
void |
attachFile(String file)
Attach a file to this body part from a file name. |
Enumeration |
getAllHeaderLines()
|
Enumeration |
getAllHeaders()
Return all headers as an Enumeration of Header objects. |
Object |
getContent()
Return a content object for this Part. |
String |
getContentID()
Retrieve the value of the "Content-ID" header. |
String[] |
getContentLanguage()
|
String |
getContentMD5()
|
protected InputStream |
getContentStream()
|
String |
getContentType()
Get the ContentType for this part, or null if the ContentType has not been set. |
DataHandler |
getDataHandler()
Returns a DataHandler instance for the content with in the Part. |
String |
getDescription()
Returns a description string for this Part. |
String |
getDisposition()
Retrieve the message "Content-Disposition" header field. |
String |
getEncoding()
Retrieves the current value of the "Content-Transfer-Encoding" header. |
String |
getFileName()
Get a file name associated with this part. |
String[] |
getHeader(String name)
Get all Headers for this header name. |
String |
getHeader(String name,
String delimiter)
|
InputStream |
getInputStream()
Return an InputStream for accessing the Part content. |
int |
getLineCount()
Return the number of lines in the content, or -1 if the line count cannot be determined. |
Enumeration |
getMatchingHeaderLines(String[] names)
|
Enumeration |
getMatchingHeaders(String[] name)
Return all headers that match the list of names as an Enumeration of Header objects. |
Enumeration |
getNonMatchingHeaderLines(String[] names)
|
Enumeration |
getNonMatchingHeaders(String[] name)
Return an Enumeration of all Headers except those that match the names given in the exclusion list. |
InputStream |
getRawInputStream()
|
int |
getSize()
Return the content size of this message. |
boolean |
isMimeType(String type)
Tests to see if this message has a mime-type match with the given type name. |
void |
removeHeader(String name)
Remove all headers with the given name from the Part. |
void |
saveFile(File file)
Save the body part content to a given target file. |
void |
saveFile(String file)
Save the body part content to a given target file. |
void |
setContent(Multipart part)
|
void |
setContent(Object content,
String type)
Set a content object for this part. |
void |
setContentID(String cid)
|
void |
setContentLanguage(String[] languages)
|
void |
setContentMD5(String md5)
|
void |
setDataHandler(DataHandler handler)
Set a DataHandler for this part that defines the Part content. |
void |
setDescription(String description)
Set a descriptive string for this part. |
void |
setDescription(String description,
String charset)
|
void |
setDisposition(String disposition)
Set a new dispostion value for the "Content-Disposition" field. |
void |
setFileName(String name)
Set a descriptive file name for this part. |
void |
setHeader(String name,
String value)
Sets a value for the given header. |
void |
setText(String text)
Set the Part content as text. |
void |
setText(String text,
String charset)
|
void |
setText(String text,
String charset,
String subtype)
|
protected void |
updateHeaders()
|
void |
writeTo(OutputStream out)
Write the Part content out to the provided OutputStream as a byte stream using an encoding appropriate to the Part content. |
Methods inherited from class javax.mail.BodyPart |
---|
getParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DataHandler dh
DataHandler
for this Message's content.
protected byte[] content
protected 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
Constructor Detail |
---|
public MimeBodyPart()
public MimeBodyPart(InputStream in) throws MessagingException
MessagingException
public MimeBodyPart(InternetHeaders headers, byte[] content) throws MessagingException
MessagingException
Method Detail |
---|
public int getSize() throws MessagingException
getSize
in interface Part
MessagingException
public int getLineCount() throws MessagingException
Part
getLineCount
in interface Part
MessagingException
public String getContentType() throws MessagingException
Part
getContentType
in interface Part
MessagingException
public boolean isMimeType(String type) throws MessagingException
isMimeType
in interface Part
type
- The tested type name.
MessagingException
public String getDisposition() throws MessagingException
getDisposition
in interface Part
MessagingException
public void setDisposition(String disposition) throws MessagingException
setDisposition
in interface Part
disposition
- The new disposition value.
MessagingException
public String getEncoding() throws MessagingException
getEncoding
in interface MimePart
MessagingException
public String getContentID() throws MessagingException
getContentID
in interface MimePart
MessagingException
public void setContentID(String cid) throws MessagingException
MessagingException
public String getContentMD5() throws MessagingException
getContentMD5
in interface MimePart
MessagingException
public void setContentMD5(String md5) throws MessagingException
setContentMD5
in interface MimePart
MessagingException
public String[] getContentLanguage() throws MessagingException
getContentLanguage
in interface MimePart
MessagingException
public void setContentLanguage(String[] languages) throws MessagingException
setContentLanguage
in interface MimePart
MessagingException
public String getDescription() throws MessagingException
Part
getDescription
in interface Part
MessagingException
public void setDescription(String description) throws MessagingException
Part
setDescription
in interface Part
description
- The new description.
MessagingException
public void setDescription(String description, String charset) throws MessagingException
MessagingException
public String getFileName() throws MessagingException
Part
getFileName
in interface Part
MessagingException
public void setFileName(String name) throws MessagingException
Part
setFileName
in interface Part
name
- The new name value.
MessagingException
public InputStream getInputStream() throws MessagingException, IOException
Part
getInputStream
in interface Part
MessagingException
IOException
protected InputStream getContentStream() throws MessagingException
MessagingException
public InputStream getRawInputStream() throws MessagingException
MessagingException
public DataHandler getDataHandler() throws MessagingException
Part
getDataHandler
in interface Part
MessagingException
public Object getContent() throws MessagingException, IOException
Part
getContent
in interface Part
MessagingException
IOException
public void setDataHandler(DataHandler handler) throws MessagingException
Part
setDataHandler
in interface Part
handler
- The DataHandler instance.
MessagingException
public void setContent(Object content, String type) throws MessagingException
Part
setContent
in interface Part
content
- The content object.type
- The MIME type for the inserted content Object.
MessagingException
public void setText(String text) throws MessagingException
Part
setText
in interface MimePart
setText
in interface Part
text
- The new text content, as a String object.
MessagingException
public void setText(String text, String charset) throws MessagingException
setText
in interface MimePart
MessagingException
public void setText(String text, String charset, String subtype) throws MessagingException
setText
in interface MimePart
MessagingException
public void setContent(Multipart part) throws MessagingException
setContent
in interface Part
MessagingException
public void writeTo(OutputStream out) throws IOException, MessagingException
Part
writeTo
in interface Part
out
- The target OutputStream.
IOException
MessagingException
public String[] getHeader(String name) throws MessagingException
Part
getHeader
in interface Part
name
- The target header name.
MessagingException
public String getHeader(String name, String delimiter) throws MessagingException
getHeader
in interface MimePart
MessagingException
public void setHeader(String name, String value) throws MessagingException
Part
setHeader
in interface Part
name
- The name of the target header.value
- The new value for the indicated header.
MessagingException
public void addHeader(String name, String value) throws MessagingException
Part
addHeader
in interface Part
name
- The name of the target header.value
- The value to be added to the header set.
MessagingException
public void removeHeader(String name) throws MessagingException
Part
removeHeader
in interface Part
name
- The target header name used for removal.
MessagingException
public Enumeration getAllHeaders() throws MessagingException
Part
getAllHeaders
in interface Part
MessagingException
public Enumeration getMatchingHeaders(String[] name) throws MessagingException
Part
getMatchingHeaders
in interface Part
name
- An array of names of the desired headers.
MessagingException
public Enumeration getNonMatchingHeaders(String[] name) throws MessagingException
Part
getNonMatchingHeaders
in interface Part
name
- An array of String header names that will be excluded from the return
Enumeration set.
MessagingException
public void addHeaderLine(String line) throws MessagingException
addHeaderLine
in interface MimePart
MessagingException
public Enumeration getAllHeaderLines() throws MessagingException
getAllHeaderLines
in interface MimePart
MessagingException
public Enumeration getMatchingHeaderLines(String[] names) throws MessagingException
getMatchingHeaderLines
in interface MimePart
MessagingException
public Enumeration getNonMatchingHeaderLines(String[] names) throws MessagingException
getNonMatchingHeaderLines
in interface MimePart
MessagingException
protected void updateHeaders() throws MessagingException
MessagingException
public void attachFile(File file) throws IOException, MessagingException
file
- The source File object.
IOException
MessagingException
public void attachFile(String file) throws IOException, MessagingException
file
- The source file name.
IOException
MessagingException
public void saveFile(File file) throws IOException, MessagingException
file
- The File object used to store the information.
IOException
MessagingException
public void saveFile(String file) throws IOException, MessagingException
file
- The file name used to store the information.
IOException
MessagingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |