javax.mail.internet
Class PreencodedMimeBodyPart
java.lang.Object
javax.mail.BodyPart
javax.mail.internet.MimeBodyPart
javax.mail.internet.PreencodedMimeBodyPart
- All Implemented Interfaces:
- MimePart, Part
public class PreencodedMimeBodyPart
- extends MimeBodyPart
A MimeBodyPart that handles data that has already been encoded.
This class is useful when constructing a message and attaching
data that has already been encoded (for example, using base64
encoding). The data may have been encoded by the application,
or may have been stored in a file or database in encoded form.
The encoding is supplied when this object is created. The data
is attached to this object in the usual fashion, by using the
setText
, setContent
, or
setDataHandler
methods.
- Since:
- JavaMail 1.4
Constructor Summary |
PreencodedMimeBodyPart(java.lang.String encoding)
Create a PreencodedMimeBodyPart that assumes the data is
encoded using the specified encoding. |
Method Summary |
java.lang.String |
getEncoding()
Returns the content transfer encoding specified when
this object was created. |
protected void |
updateHeaders()
Force the Content-Transfer-Encoding header to use
the encoding that was specified when this object was created. |
void |
writeTo(java.io.OutputStream os)
Output the body part as an RFC 822 format stream. |
Methods inherited from class javax.mail.internet.MimeBodyPart |
addHeader, addHeaderLine, attachFile, attachFile, getAllHeaderLines, getAllHeaders, getContent, getContentID, getContentLanguage, getContentMD5, getContentStream, getContentType, getDataHandler, getDescription, getDisposition, getFileName, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getSize, isMimeType, removeHeader, saveFile, saveFile, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setHeader, setText, setText, setText |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PreencodedMimeBodyPart
public PreencodedMimeBodyPart(java.lang.String encoding)
- Create a PreencodedMimeBodyPart that assumes the data is
encoded using the specified encoding. The encoding must
be a MIME supported Content-Transfer-Encoding.
getEncoding
public java.lang.String getEncoding()
throws MessagingException
- Returns the content transfer encoding specified when
this object was created.
- Specified by:
getEncoding
in interface MimePart
- Overrides:
getEncoding
in class MimeBodyPart
- Returns:
- content-transfer-encoding
- Throws:
MessagingException
- See Also:
MimeBodyPart.headers
writeTo
public void writeTo(java.io.OutputStream os)
throws java.io.IOException,
MessagingException
- Output the body part as an RFC 822 format stream.
- Specified by:
writeTo
in interface Part
- Overrides:
writeTo
in class MimeBodyPart
- Throws:
MessagingException
java.io.IOException
- if an error occurs writing to the
stream or if an error is generated
by the javax.activation layer.- See Also:
DataHandler.writeTo(java.io.OutputStream)
updateHeaders
protected void updateHeaders()
throws MessagingException
- Force the
Content-Transfer-Encoding
header to use
the encoding that was specified when this object was created.
- Overrides:
updateHeaders
in class MimeBodyPart
- Throws:
MessagingException
Submit a bug or feature Copyright © 2009, 2010, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.
Generated on 4-June-2010 04:34