Class SmtpAttachment


  • public class SmtpAttachment
    extends java.lang.Object
    Attachment of an SmtpMessage.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  SmtpAttachment.StreamProvider
      Provides an InputStream to read the attachment content.
    • Constructor Summary

      Constructors 
      Constructor Description
      SmtpAttachment​(java.lang.String filename, java.lang.String contentType, SmtpAttachment.StreamProvider streamProvider)
      Creates a new SmtpAttachement with the specified parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getContentType()
      Returns the Content Type.
      java.lang.String getFilename()
      Returns the file name.
      java.io.InputStream openStream()
      Opens a new InputStream on this attachment.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SmtpAttachment

        public SmtpAttachment​(java.lang.String filename,
                              java.lang.String contentType,
                              SmtpAttachment.StreamProvider streamProvider)
        Creates a new SmtpAttachement with the specified parameters.
        Parameters:
        filename - The attachment's name.
        contentType - The Content Type.
        streamProvider - The stream provider.
    • Method Detail

      • getFilename

        public java.lang.String getFilename()
        Returns the file name.
        Returns:
        The file name.
      • getContentType

        public java.lang.String getContentType()
        Returns the Content Type. Generally, this will look like
        text/plain; charset=us-ascii; name=file.txt
        .
        Returns:
        The Content TYpe.
      • openStream

        public java.io.InputStream openStream()
                                       throws java.io.IOException,
                                              javax.mail.MessagingException
        Opens a new InputStream on this attachment. This method can only be called once.
        Returns:
        A new InputStream.
        Throws:
        java.io.IOException
        javax.mail.MessagingException