Package ch.astorm.smtp4j.core
Class SmtpAttachment
java.lang.Object
ch.astorm.smtp4j.core.SmtpAttachment
Attachment of an
SmtpMessage.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProvides anInputStreamto read the attachment content. -
Constructor Summary
ConstructorsConstructorDescriptionSmtpAttachment(String filename, String contentType, SmtpAttachment.StreamProvider streamProvider) Creates a newSmtpAttachementwith the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns the Content Type.Returns the file name.Opens a newInputStreamon this attachment.
-
Constructor Details
-
SmtpAttachment
public SmtpAttachment(String filename, String contentType, SmtpAttachment.StreamProvider streamProvider) Creates a newSmtpAttachementwith the specified parameters.- Parameters:
filename- The attachment's name.contentType- The Content Type.streamProvider- The stream provider.
-
-
Method Details
-
getFilename
Returns the file name.- Returns:
- The file name.
-
getContentType
Returns the Content Type. Generally, this will look liketext/plain; charset=us-ascii; name=file.txt
.- Returns:
- The Content TYpe.
-
openStream
Opens a newInputStreamon this attachment. This method can only be called once.- Returns:
- A new
InputStream. - Throws:
IOExceptionjakarta.mail.MessagingException
-