public class AttachmentResource extends Object implements Serializable
DataSource that is compatible with the javax.mail API.DataSource,
Serialized Form| Constructor and Description |
|---|
AttachmentResource(@Nullable String name,
@NotNull DataSource dataSource)
Constructor; initializes the attachment resource with a name and data.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(@Nullable Object o) |
@NotNull DataSource |
getDataSource() |
@NotNull InputStream |
getDataSourceInputStream()
Delegates to
DataSource.getInputStream() |
@Nullable String |
getName() |
int |
hashCode() |
@NotNull byte[] |
readAllBytes()
Delegates to
MiscUtil.readInputStreamToBytes(InputStream) with data source input stream. |
@NotNull String |
readAllData() |
@NotNull String |
readAllData(@NotNull Charset charset)
Delegates to
MiscUtil.readInputStreamToString(InputStream, Charset) with data source input stream. |
@NotNull String |
toString() |
public AttachmentResource(@Nullable
@Nullable String name,
@NotNull
@NotNull 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@NotNull public @NotNull String readAllData() throws IOException
IOException - See readAllData(Charset)@NotNull
public @NotNull byte[] readAllBytes()
throws IOException
MiscUtil.readInputStreamToBytes(InputStream) with data source input stream.IOException@NotNull public @NotNull String readAllData(@NotNull @NotNull Charset charset) throws IOException
MiscUtil.readInputStreamToString(InputStream, Charset) with data source input stream.IOException@NotNull public @NotNull DataSource getDataSource()
dataSource@NotNull public @NotNull InputStream getDataSourceInputStream()
DataSource.getInputStream()Copyright © 2009–2022. All rights reserved.