Package de.aristaflow.adept2.model.mail
Class UDTAttachment
- java.lang.Object
-
- de.aristaflow.adept2.model.mail.SerialisableAttachment
-
- de.aristaflow.adept2.model.mail.UDTAttachment
-
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
public class UDTAttachment extends SerialisableAttachment
ASerialisableAttachment
having anUDTValue
as content.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Cleanup<IOException>
cleanup
The clean-up for closing theUDTValue
as post-mortem task for this instance.protected UDTValue
udt
The content represented asUDTValue
.-
Fields inherited from class de.aristaflow.adept2.model.mail.SerialisableAttachment
contentType, description, inlineName, name
-
-
Constructor Summary
Constructors Constructor Description UDTAttachment(String name, String description, UDTValue udt)
Creates an attachment having the designated name, description and content.UDTAttachment(String name, String description, UDTValue udt, boolean inline)
Creates an attachment having the designated name, description and content.UDTAttachment(String name, String description, UDTValue udt, String inlineName)
Creates an attachment having the designated name, description and content.UDTAttachment(String name, String description, String contentType, UDTValue udt)
Creates an attachment having the designated name, description, content type (MIME) and content.UDTAttachment(String name, String description, String contentType, UDTValue udt, boolean inline)
Creates an attachment having the designated name, description, content type (MIME) and content.UDTAttachment(String name, String description, String contentType, UDTValue udt, String inlineName)
Creates an attachment having the designated name, description, content type (MIME) and content.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
InputStream
getContent()
Gets the content of the attachment represented asInputStream
.-
Methods inherited from class de.aristaflow.adept2.model.mail.SerialisableAttachment
getContentType, getDescription, getInlineName, getName
-
-
-
-
Field Detail
-
udt
protected final UDTValue udt
The content represented asUDTValue
.
-
cleanup
protected transient Cleanup<IOException> cleanup
The clean-up for closing theUDTValue
as post-mortem task for this instance.
-
-
Constructor Detail
-
UDTAttachment
public UDTAttachment(String name, String description, UDTValue udt)
Creates an attachment having the designated name, description and content. The content type is set to "application/octet-stream".- Parameters:
name
- The name of the attachment.description
- The description of the attachment.udt
- The content of the attachment represented asUDTValue
. The caller is responsible for closing.
-
UDTAttachment
public UDTAttachment(String name, String description, UDTValue udt, boolean inline)
Creates an attachment having the designated name, description and content. The content type is set to "application/octet-stream".- Parameters:
name
- The name of the attachment.description
- The description of the attachment.udt
- The content of the attachment represented asUDTValue
. The caller is responsible for closing.inline
- Whether to inline this attachment in case of an HTML message using the designated name.
-
UDTAttachment
public UDTAttachment(String name, String description, UDTValue udt, String inlineName)
Creates an attachment having the designated name, description and content. The content type is set to "application/octet-stream".- Parameters:
name
- The name of the attachment.description
- The description of the attachment.udt
- The content of the attachment represented asUDTValue
. The caller is responsible for closing.inlineName
- The name used in the corresponding HTML message to refer to this attachment to be inlined. Usenull
to not inline the attachment.
-
UDTAttachment
public UDTAttachment(String name, String description, String contentType, UDTValue udt)
Creates an attachment having the designated name, description, content type (MIME) and content.- Parameters:
name
- The name of the attachment.description
- The description of the attachment.contentType
- The content type (MIME) of the attachment.udt
- The content of the attachment represented asUDTValue
. The caller is responsible for closing.
-
UDTAttachment
public UDTAttachment(String name, String description, String contentType, UDTValue udt, boolean inline)
Creates an attachment having the designated name, description, content type (MIME) and content.- Parameters:
name
- The name of the attachment.description
- The description of the attachment.contentType
- The content type (MIME) of the attachment.udt
- The content of the attachment represented asUDTValue
. The caller is responsible for closing.inline
- Whether to inline this attachment in case of an HTML message using the designated name.
-
UDTAttachment
public UDTAttachment(String name, String description, String contentType, UDTValue udt, String inlineName)
Creates an attachment having the designated name, description, content type (MIME) and content.- Parameters:
name
- The name of the attachment.description
- The description of the attachment.contentType
- The content type (MIME) of the attachment.udt
- The content of the attachment represented asUDTValue
. The caller is responsible for closing.inlineName
- The name used in the corresponding HTML message to refer to this attachment to be inlined. Usenull
to not inline the attachment.
-
-
Method Detail
-
getContent
public InputStream getContent() throws IOException
Description copied from class:SerialisableAttachment
Gets the content of the attachment represented asInputStream
.
Note that this should only be called by the receiving service since theInputStream
cannot be serialised.- Specified by:
getContent
in classSerialisableAttachment
- Returns:
- The actual data of the attachment. The caller is responsible for closing.
- Throws:
IOException
- If there are problems retrieving the content, for instance converting the transferred serialisable data to anInputStream
, anIOException
will be thrown.
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classSerialisableAttachment
- Throws:
IOException
-
-