public abstract class Attachment extends Object implements DataSource
| Constructor and Description |
|---|
Attachment(String name,
String mimeType,
boolean asAlternative)
Generates a new attachment with the given name, mime type and contents.
|
| Modifier and Type | Method and Description |
|---|---|
Attachment |
addHeader(String name,
String value)
Adds a header to the attachment.
|
String |
getContentType() |
Set<Map.Entry<String,String>> |
getHeaders()
Returns all headers declared for this attachment.
|
String |
getName() |
OutputStream |
getOutputStream() |
boolean |
isAlternative()
Determines if this is an "alternative" to the text content of the mail or a "real" attachment
|
Attachment |
withContentType(String contentType)
Updates the content type of the attachment.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInputStreampublic Attachment(String name, String mimeType, boolean asAlternative)
name - the name of the attached filemimeType - the mime type of the file. Use MimeHelper to determine it at
runtime if it is not know in advanceasAlternative - determines if this attachment is an alternative to the text content of the mail
(true) or a real attachment (false)public Attachment addHeader(String name, String value)
name - the name of the headervalue - the value of the headerpublic Attachment withContentType(String contentType)
contentType - the new content type to usepublic String getContentType()
getContentType in interface DataSourcepublic String getName()
getName in interface DataSourcepublic OutputStream getOutputStream() throws IOException
getOutputStream in interface DataSourceIOExceptionpublic Set<Map.Entry<String,String>> getHeaders()
public boolean isAlternative()
Copyright © 2018. All rights reserved.