public interface IncomingAttachment extends Attachment
FILE_ATTACHMENT, MEMORY_ATTACHMENT, OUTPUTSTREAM_ATTACHMENT, STREAM_ATTACHMENT| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBytes()
Returns the raw data from this attachment as array of bytes.
|
java.io.InputStream |
getInputStream()
Returns the input stream which contains the data.
|
boolean |
isAvailable()
Returns
true if this attachment is ready to be processed. |
canDetermineSize, dispose, getContentId, getContentType, getType, sizejava.io.InputStream getInputStream()
throws AttachmentException,
java.io.IOException
Depending on the actual attachment implementation, this method may either always return the
same java.io.InputStream instance, or it could create a new one on each call. In
the first case, it is important to note that reading the attachment data might be possible only
once, as the returned stream is not guaranteed to support resetting (see Attachment.getType().
AttachmentException - if attachment processing is not supported within the current runtime or obtaining the attachment failed
for any reasonjava.io.IOException - if reading raw attachment data failedAttachment.getType(),
Attachment.size(),
getBytes()boolean isAvailable()
true if this attachment is ready to be processed.
Because the JMEDS framework handles attachments asynchronously, it is possible (and will
most likely occur frequently) for an attachement's raw data to still be being transmitted over
the network while a caller's business logic (e.g. the Operation.invoke(ParameterValue)
method) gets called providing access to the attachment by means of its ParameterValue.get(String). Using methods other than Attachment.getContentId() or isAvailable() on this attachment would block the caller until the entire attachment is read
out. Thus, this method allows to check whether further examination of this attachment would
block it or not.
true, if this attachment is already available, false if it is still not
received (entirely)byte[] getBytes()
throws AttachmentException,
java.io.IOException
WARNING: The result can potentially use a large amount of memory.
Furthermore, some environments or some types of attachments (see e.g. InputStreamAttachment or
FileAttachment) may not support representing the attachment's raw data as a byte array. In
these cases, a call to this method will cause an AttachmentException to get thrown (see
Attachment.getType().
AttachmentException - if attachment processing is not supported within the current runtime or obtaining the attachment failed
for any reason or in particular, when this attachment type doesn't support byte array access to its raw
datajava.io.IOException - if reading raw attachment data failedAttachment.getType(),
getInputStream()