SMILA 1.0 API documentation

org.eclipse.smila.datamodel
Interface Attachment

All Known Implementing Classes:
InMemoryAttachment, StoredAttachment

public interface Attachment

Interface of record attachments.


Method Summary
 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.
 

Method Detail

getName

java.lang.String getName()
Returns:
name of attachment.

size

long size()
get size of attachments. Result can be negative is the implementation does not know the size.

Returns:
number of bytes in attachment.

getAsBytes

byte[] getAsBytes()
get attachment content as a byte array.

Returns:
attachment content as a byte[]
Throws:
AttachmentException - if attachment content could not be read to byte array (if not in memory already) or if it is big to fit in byte[]

getAsBytes

byte[] getAsBytes(int length)
get start of attachment content as byte[].

Returns:
first length bytes of attachment content.
Throws:
AttachmentException - if attachment content could not be read to byte array (if not in memory already).

getAsStream

java.io.InputStream getAsStream()
get attachment content for streaming.

Returns:
a stream for reading the attachment.
Throws:
AttachmentException - if no stream could be created.

dispose

void dispose()
called to denote that this attachment is not needed anymore and used resources can be released.


SMILA 1.0 API documentation