public class AttachmentResource extends Object implements Serializable
DataSource that is compatible with the jakarta.mail API.DataSource,
Serialized Form| Constructor and Description |
|---|
AttachmentResource(@Nullable String name,
@NotNull jakarta.activation.DataSource dataSource)
Delegates to
AttachmentResource(String, DataSource, String, ContentTransferEncoding) with null-description and no forced content transfer encoding |
AttachmentResource(@Nullable String name,
@NotNull jakarta.activation.DataSource dataSource,
@Nullable String description)
Delegates to
AttachmentResource(String, DataSource, String, ContentTransferEncoding) with no forced content transfer encoding |
AttachmentResource(@Nullable String name,
@NotNull jakarta.activation.DataSource dataSource,
@Nullable String description,
@Nullable ContentTransferEncoding contentTransferEncoding)
Constructor; initializes the attachment resource with a name and data.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(@Nullable Object o) |
@Nullable ContentTransferEncoding |
getContentTransferEncoding() |
@NotNull jakarta.activation.DataSource |
getDataSource() |
@NotNull InputStream |
getDataSourceInputStream()
Delegates to
DataSource.getInputStream() |
@Nullable String |
getDescription() |
@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 jakarta.activation.DataSource dataSource)
AttachmentResource(String, DataSource, String, ContentTransferEncoding) with null-description and no forced content transfer encodingpublic AttachmentResource(@Nullable
@Nullable String name,
@NotNull
@NotNull jakarta.activation.DataSource dataSource,
@Nullable
@Nullable String description)
AttachmentResource(String, DataSource, String, ContentTransferEncoding) with no forced content transfer encodingpublic AttachmentResource(@Nullable
@Nullable String name,
@NotNull
@NotNull jakarta.activation.DataSource dataSource,
@Nullable
@Nullable String description,
@Nullable
@Nullable ContentTransferEncoding contentTransferEncoding)
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.description - An optional description that will find its way in the MimeMEssage with the Content-Description header. This is rarely needed.contentTransferEncoding - An optional encoder option to force the data encoding while in MimeMessage/EML format.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 InputStream getDataSourceInputStream()
DataSource.getInputStream()@NotNull public @NotNull jakarta.activation.DataSource getDataSource()
@Nullable public @Nullable String getName()
@Nullable public @Nullable String getDescription()
@Nullable public @Nullable ContentTransferEncoding getContentTransferEncoding()
Copyright © 2009–2023. All rights reserved.