public class StoredAttachment extends java.lang.Object implements Attachment, java.io.Serializable
AttachmentException.
TODO: Add subclasses that are able to deliver the attachment content from the respective storage.
| Modifier and Type | Field and Description |
|---|---|
static long |
SIZE_UNKNOWN
result of
size() if size is not known. |
| Constructor and Description |
|---|
StoredAttachment(java.lang.String name)
create instance with unknown size.
|
StoredAttachment(java.lang.String name,
long size)
create instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
called to denote that this attachment is not needed anymore and used resources can be released.
|
byte[] |
getAsBytes()
get attachment content as a byte array.
|
byte[] |
getAsBytes(int length)
get start of attachment content as byte[].
|
java.io.InputStream |
getAsStream()
get attachment content for streaming.
|
java.lang.String |
getName() |
long |
size()
get size of attachments.
|
java.lang.String |
toString() |
public static final long SIZE_UNKNOWN
size() if size is not known.public StoredAttachment(java.lang.String name)
public StoredAttachment(java.lang.String name,
long size)
public java.lang.String getName()
getName in interface Attachmentpublic long size()
Attachmentsize in interface Attachmentpublic byte[] getAsBytes()
AttachmentgetAsBytes in interface Attachmentpublic byte[] getAsBytes(int length)
AttachmentgetAsBytes in interface Attachmentpublic java.io.InputStream getAsStream()
AttachmentgetAsStream in interface Attachmentpublic void dispose()
Attachmentdispose in interface Attachmentpublic java.lang.String toString()
toString in class java.lang.Object