|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.mail.BodyPart
javax.mail.internet.MimeBodyPart
com.sun.mail.mbox.SunV3BodyPart
public class SunV3BodyPart
This class represents a SunV3 BodyPart.
Part
,
MimePart
,
MimeBodyPart
Field Summary |
---|
Fields inherited from class javax.mail.internet.MimeBodyPart |
---|
content, contentStream, dh, headers |
Fields inherited from class javax.mail.BodyPart |
---|
parent |
Fields inherited from interface javax.mail.Part |
---|
ATTACHMENT, INLINE |
Constructor Summary | |
---|---|
SunV3BodyPart(javax.mail.internet.InternetHeaders headers,
byte[] content)
Constructs a SunV3BodyPart using the given header and content bytes. |
Method Summary | |
---|---|
java.lang.String |
getContentType()
Returns the value of the RFC822 "Content-Type" header field. |
java.lang.String |
getDescription()
Returns the "Content-Description" header field of this BodyPart. |
java.lang.String |
getEncoding()
Returns the value of the "Content-Transfer-Encoding" header field. |
java.lang.String |
getFileName()
Get the filename associated with this BodyPart. |
int |
getLineCount()
Return the number of lines for the content of this Part. |
int |
getSize()
Return the size of the content of this BodyPart in bytes. |
void |
setDataHandler(javax.activation.DataHandler dh)
This method provides the mechanism to set this BodyPart's content. |
void |
setDescription(java.lang.String description)
Set the "Content-Description" header field for this BodyPart. |
void |
setDescription(java.lang.String description,
java.lang.String charset)
Set the "Content-Description" header field for this BodyPart. |
void |
setFileName(java.lang.String filename)
Set the filename associated with this BodyPart, if possible. |
protected void |
updateHeaders()
This is the method that has the 'smarts' to query the 'content' and update the appropriate headers. |
void |
writeTo(java.io.OutputStream os)
Output the BodyPart as a RFC822 format stream. |
Methods inherited from class javax.mail.internet.MimeBodyPart |
---|
addHeader, addHeaderLine, attachFile, attachFile, getAllHeaderLines, getAllHeaders, getContent, getContentID, getContentLanguage, getContentMD5, getContentStream, getDataHandler, getDisposition, getHeader, getHeader, getInputStream, getMatchingHeaderLines, getMatchingHeaders, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, isMimeType, removeHeader, saveFile, saveFile, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDisposition, setHeader, setText, setText, setText |
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 |
Constructor Detail |
---|
public SunV3BodyPart(javax.mail.internet.InternetHeaders headers, byte[] content) throws javax.mail.MessagingException
Used by providers.
headers
- The header of this partcontent
- bytes representing the body of this part.
javax.mail.MessagingException
Method Detail |
---|
public int getSize() throws javax.mail.MessagingException
Note that this number may not be an exact measure of the content size and may or may not account for any transfer encoding of the content.
getSize
in interface javax.mail.Part
getSize
in class javax.mail.internet.MimeBodyPart
javax.mail.MessagingException
public int getLineCount() throws javax.mail.MessagingException
Note that this number may not be an exact measure of the content length and may or may not account for any transfer encoding of the content.
getLineCount
in interface javax.mail.Part
getLineCount
in class javax.mail.internet.MimeBodyPart
javax.mail.MessagingException
public java.lang.String getContentType() throws javax.mail.MessagingException
This implementation uses getHeader(name)
to obtain the requisite header field.
getContentType
in interface javax.mail.Part
getContentType
in class javax.mail.internet.MimeBodyPart
javax.mail.MessagingException
DataHandler
public java.lang.String getEncoding() throws javax.mail.MessagingException
null
if the header is unavailable
or its value is absent.
This implementation uses getHeader(name)
to obtain the requisite header field.
getEncoding
in interface javax.mail.internet.MimePart
getEncoding
in class javax.mail.internet.MimeBodyPart
javax.mail.MessagingException
MimeBodyPart.headers
public java.lang.String getDescription() throws javax.mail.MessagingException
If the Content-Description field is encoded as per RFC 2047, it is decoded and converted into Unicode. If the decoding or conversion fails, the raw data is returned as-is
This implementation uses getHeader(name)
to obtain the requisite header field.
getDescription
in interface javax.mail.Part
getDescription
in class javax.mail.internet.MimeBodyPart
javax.mail.MessagingException
public void setDescription(java.lang.String description) throws javax.mail.MessagingException
null
, then any
existing "Content-Description" fields are removed. If the description contains non US-ASCII characters, it will be encoded using the platform's default charset. If the description contains only US-ASCII characters, no encoding is done and it is used as-is.
setDescription
in interface javax.mail.Part
setDescription
in class javax.mail.internet.MimeBodyPart
description
- content-description
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
java.lang.IllegalStateException
- if this BodyPart is
obtained from a READ_ONLY folder.
javax.mail.MessagingException
- otherwise; an
UnsupportedEncodingException may be included
in the exception chain if the charset
conversion fails.public void setDescription(java.lang.String description, java.lang.String charset) throws javax.mail.MessagingException
null
, then any
existing "Content-Description" fields are removed. If the description contains non US-ASCII characters, it will be encoded using the specified charset. If the description contains only US-ASCII characters, no encoding is done and it is used as-is
setDescription
in class javax.mail.internet.MimeBodyPart
description
- Descriptioncharset
- Charset for encoding
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
java.lang.IllegalStateException
- if this BodyPart is
obtained from a READ_ONLY folder.
javax.mail.MessagingException
- otherwise; an
UnsupportedEncodingException may be included
in the exception chain if the charset
conversion fails.public java.lang.String getFileName() throws javax.mail.MessagingException
Returns the value of the "filename" parameter from the
"Content-Disposition" header field of this BodyPart. If its
not available, returns the value of the "name" parameter from
the "Content-Type" header field of this BodyPart.
Returns null
if both are absent.
getFileName
in interface javax.mail.Part
getFileName
in class javax.mail.internet.MimeBodyPart
javax.mail.MessagingException
public void setFileName(java.lang.String filename) throws javax.mail.MessagingException
Sets the "filename" parameter of the "Content-Disposition" header field of this BodyPart.
setFileName
in interface javax.mail.Part
setFileName
in class javax.mail.internet.MimeBodyPart
filename
- Filename to associate with this part
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
java.lang.IllegalStateException
- if this BodyPart is
obtained from a READ_ONLY folder.
javax.mail.MessagingException
public void setDataHandler(javax.activation.DataHandler dh) throws javax.mail.MessagingException
setDataHandler
in interface javax.mail.Part
setDataHandler
in class javax.mail.internet.MimeBodyPart
dh
- The DataHandler for the content
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
java.lang.IllegalStateException
- if this BodyPart is
obtained from a READ_ONLY folder.
javax.mail.MessagingException
public void writeTo(java.io.OutputStream os) throws java.io.IOException, javax.mail.MessagingException
writeTo
in interface javax.mail.Part
writeTo
in class javax.mail.internet.MimeBodyPart
javax.mail.MessagingException
java.io.IOException
- if an error occurs writing to the
stream or if an error is generated
by the javax.activation layer.javax.activation.DataHandler#writeTo()
protected void updateHeaders() throws javax.mail.MessagingException
updateHeaders
in class javax.mail.internet.MimeBodyPart
javax.mail.MessagingException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |