java.lang.Object
jakarta.mail.Message
jakarta.mail.internet.MimeMessage
org.eclipse.angus.mail.dsn.MessageHeaders
A special MimeMessage object that contains only message headers,
no content. Used to represent the MIME type text/rfc822-headers.
- Since:
- JavaMail 1.4
-
Nested Class Summary
Nested classes/interfaces inherited from class jakarta.mail.internet.MimeMessage
MimeMessage.RecipientType
-
Field Summary
Fields inherited from class jakarta.mail.internet.MimeMessage
cachedContent, content, contentStream, dh, flags, headers, modified, saved
Fields inherited from interface jakarta.mail.Part
ATTACHMENT, INLINE
-
Constructor Summary
ConstructorDescriptionConstruct a MessageHeaders object.MessageHeaders
(InternetHeaders headers) Constructs a MessageHeaders object using the given InternetHeaders.Constructs a MessageHeaders object from the given InputStream. -
Method Summary
Modifier and TypeMethodDescriptionprotected InputStream
Produce the raw bytes of the content.Return a decoded input stream for this Message's "content".int
getSize()
Return the size of this message.void
setDataHandler
(jakarta.activation.DataHandler dh) Can't set any content for a MessageHeaders object.Methods inherited from class jakarta.mail.internet.MimeMessage
addFrom, addHeader, addHeaderLine, addRecipients, addRecipients, createInternetHeaders, createMimeMessage, getAllHeaderLines, getAllHeaders, getAllRecipients, getContent, getContentID, getContentLanguage, getContentMD5, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getFlags, getFrom, getHeader, getHeader, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getMessageID, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getReceivedDate, getRecipients, getReplyTo, getSender, getSentDate, getSubject, isMimeType, isSet, parse, removeHeader, reply, reply, saveChanges, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDescription, setDescription, setDisposition, setFileName, setFlags, setFrom, setFrom, setFrom, setHeader, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, updateHeaders, updateMessageID, writeTo, writeTo
Methods inherited from class jakarta.mail.Message
addRecipient, getFolder, getMessageNumber, getSession, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient
-
Constructor Details
-
MessageHeaders
Construct a MessageHeaders object.- Throws:
MessagingException
- for failures
-
MessageHeaders
Constructs a MessageHeaders object from the given InputStream.- Parameters:
is
- InputStream- Throws:
MessagingException
- for failures
-
MessageHeaders
Constructs a MessageHeaders object using the given InternetHeaders.- Parameters:
headers
- InternetHeaders to use- Throws:
MessagingException
- for failures
-
-
Method Details
-
getSize
public int getSize()Return the size of this message. Always returns zero.- Specified by:
getSize
in interfacePart
- Overrides:
getSize
in classMimeMessage
- Returns:
- size of content in bytes
-
getInputStream
Description copied from class:MimeMessage
Return a decoded input stream for this Message's "content".This implementation obtains the input stream from the DataHandler, that is, it invokes
getDataHandler().getInputStream()
.- Specified by:
getInputStream
in interfacePart
- Overrides:
getInputStream
in classMimeMessage
- Returns:
- an InputStream
- See Also:
-
MimeMessage.getContentStream()
DataHandler.getInputStream()
-
getContentStream
Description copied from class:MimeMessage
Produce the raw bytes of the content. This method is used during parsing, to create a DataHandler object for the content. Subclasses that can provide a separate input stream for just the message content might want to override this method.This implementation returns a SharedInputStream, if
contentStream
is not null. Otherwise, it returns a ByteArrayInputStream constructed out of thecontent
byte array.- Overrides:
getContentStream
in classMimeMessage
- Returns:
- an InputStream containing the raw bytes
- See Also:
-
setDataHandler
Can't set any content for a MessageHeaders object.- Specified by:
setDataHandler
in interfacePart
- Overrides:
setDataHandler
in classMimeMessage
- Parameters:
dh
- The DataHandler for the content.- Throws:
MessagingException
- always
-