Class MessageHeaders

  • All Implemented Interfaces:
    MimePart, Part

    public class MessageHeaders
    extends MimeMessage
    A special MimeMessage object that contains only message headers, no content. Used to represent the MIME type text/rfc822-headers.
    Since:
    JavaMail 1.4
    • Constructor Detail

      • MessageHeaders

        public MessageHeaders​(java.io.InputStream is)
                       throws MessagingException
        Constructs a MessageHeaders object from the given InputStream.
        Parameters:
        is - InputStream
        Throws:
        MessagingException - for failures
    • Method Detail

      • getSize

        public int getSize()
        Return the size of this message. Always returns zero.
        Specified by:
        getSize in interface Part
        Overrides:
        getSize in class MimeMessage
        Returns:
        size of content in bytes
      • getInputStream

        public java.io.InputStream 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 interface Part
        Overrides:
        getInputStream in class MimeMessage
        Returns:
        an InputStream
        See Also:
        MimeMessage.getContentStream(), DataHandler.getInputStream()
      • getContentStream

        protected java.io.InputStream 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 the content byte array.

        Overrides:
        getContentStream in class MimeMessage
        Returns:
        an InputStream containing the raw bytes
        See Also:
        MimeMessage.content