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 Details

  • Method Details

    • 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 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:
    • getContentStream

      protected 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:
    • setDataHandler

      public void setDataHandler(jakarta.activation.DataHandler dh) throws MessagingException
      Can't set any content for a MessageHeaders object.
      Specified by:
      setDataHandler in interface Part
      Overrides:
      setDataHandler in class MimeMessage
      Parameters:
      dh - The DataHandler for the content.
      Throws:
      MessagingException - always