Class LegacySendMailJob.MemoryAttachment
java.lang.Object
ch.tocco.nice2.optional.address.impl.action.mail.legacy.LegacySendMailJob.MemoryAttachment
- All Implemented Interfaces:
Serializable
- Enclosing class:
LegacySendMailJob
A bean for durable and ephemeral attachements.
The
fromBinary(MultiUploadService, String)
is the
recommended constructor. It loads the binary via MultiUploadService
(it must be available this way at construction time). If the returned
binary is _ephemeral_, i.e. a temporary file, it is read into a byte array
and stored in its base64 representation in this class. Otherwise the `data`
field is the uri as given to the constructor, because it is not needed to
store yet another copy in this class. It should be used with
MultiUploadService
as usual to obtain the data.- See Also:
-
Constructor Summary
ConstructorDescriptionMemoryAttachment
(String data, String mimeType, String name, MultiUploadService.BinaryResource.Source source) -
Method Summary
Modifier and TypeMethodDescriptionfromBinary
(MultiUploadService multiUploadService, String uri) getData()
If this was constructed from an ephemeralgetSource()
, this returns the bytes as base64.getId()
getName()
void
void
setMimeType
(String mimeType) void
void
-
Constructor Details
-
MemoryAttachment
public MemoryAttachment(String data, String mimeType, String name, MultiUploadService.BinaryResource.Source source)
-
-
Method Details
-
fromBinary
public static LegacySendMailJob.MemoryAttachment fromBinary(MultiUploadService multiUploadService, String uri) throws IOException, PersistException - Throws:
IOException
PersistException
-
getId
-
getSource
-
setSource
-
getData
If this was constructed from an ephemeralgetSource()
, this returns the bytes as base64. Otherwise it is an uri into the dms. -
setData
-
getMimeType
-
setMimeType
-
getName
-
setName
-