public class AttachmentResource extends Object
DataSource
that is compatible with the javax.mail API.DataSource
Constructor and Description |
---|
AttachmentResource(String name,
DataSource dataSource)
Constructor; initializes the attachment resource with a name and data.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
DataSource |
getDataSource() |
String |
getName() |
int |
hashCode() |
String |
readAllData() |
String |
readAllData(Charset charset) |
String |
toString() |
public AttachmentResource(@Nullable String name, @Nonnull DataSource dataSource)
name
- The name of the attachment which can be a simple name, a filename or a named embedded image (eg. <cid:footer>). Leave
null
to fall back on DataSource.getName()
.dataSource
- The attachment data. If no name was provided, the name of this datasource is used if provided.DataSource
@Nonnull public String readAllData() throws IOException
IOException
- See readAllData(Charset)
@Nonnull public String readAllData(@Nonnull Charset charset) throws IOException
IOException
- See readAllData(Charset)
public DataSource getDataSource()
dataSource
Copyright © 2017. All rights reserved.