- java.lang.Object
-
- javax.mail.BodyPart
-
- javax.mail.internet.MimeBodyPart
-
- javax.mail.internet.PreencodedMimeBodyPart
-
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 thesetText
,setContent
, orsetDataHandler
methods.- Since:
- JavaMail 1.4
-
-
Field Summary
-
Fields inherited from class javax.mail.internet.MimeBodyPart
cachedContent, content, contentStream, dh, headers
-
Fields inherited from class javax.mail.BodyPart
parent
-
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
-
-
Constructor Summary
Constructors Constructor and Description PreencodedMimeBodyPart(String encoding)
Create a PreencodedMimeBodyPart that assumes the data is encoded using the specified encoding.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description String
getEncoding()
Returns the content transfer encoding specified when this object was created.protected void
updateHeaders()
Force theContent-Transfer-Encoding
header to use the encoding that was specified when this object was created.void
writeTo(OutputStream os)
Output the body part as an RFC 822 format stream.-
Methods inherited from class javax.mail.internet.MimeBodyPart
addHeader, addHeaderLine, attachFile, attachFile, 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 javax.mail.BodyPart
getParent
-
-
-
-
Constructor Detail
-
PreencodedMimeBodyPart
public PreencodedMimeBodyPart(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.
-
-
Method Detail
-
getEncoding
public String getEncoding() throws MessagingException
Returns the content transfer encoding specified when this object was created.- Specified by:
getEncoding
in interfaceMimePart
- Overrides:
getEncoding
in classMimeBodyPart
- Returns:
- content-transfer-encoding
- Throws:
MessagingException
- See Also:
MimeBodyPart.headers
-
writeTo
public void writeTo(OutputStream os) throws IOException, MessagingException
Output the body part as an RFC 822 format stream.- Specified by:
writeTo
in interfacePart
- Overrides:
writeTo
in classMimeBodyPart
- Throws:
MessagingException
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 theContent-Transfer-Encoding
header to use the encoding that was specified when this object was created.- Overrides:
updateHeaders
in classMimeBodyPart
- Throws:
MessagingException
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/08/2025 15:07:13 Cette version de la page est en cache (à la date du 21/08/2025 15:07:13) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 19/04/2008, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/mail/internet/PreencodedMimeBodyPart.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.