SMILA 1.0 API documentation

org.eclipse.smila.datamodel
Class InMemoryAttachment

java.lang.Object
  extended by org.eclipse.smila.datamodel.InMemoryAttachment
All Implemented Interfaces:
java.io.Serializable, Attachment

public class InMemoryAttachment
extends java.lang.Object
implements Attachment, java.io.Serializable

default in-memory implementation of Attachments.

See Also:
Serialized Form

Constructor Summary
InMemoryAttachment(java.lang.String name, byte[] content)
          create instance.
 
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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InMemoryAttachment

public InMemoryAttachment(java.lang.String name,
                          byte[] content)
create instance. Both arguments must not be null.

Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Attachment
Returns:
name of attachment.

size

public long size()
Description copied from interface: Attachment
get size of attachments. Result can be negative is the implementation does not know the size.

Specified by:
size in interface Attachment
Returns:
number of bytes in attachment.

getAsBytes

public byte[] getAsBytes()
Description copied from interface: Attachment
get attachment content as a byte array.

Specified by:
getAsBytes in interface Attachment
Returns:
attachment content as a byte[]

getAsBytes

public byte[] getAsBytes(int length)
Description copied from interface: Attachment
get start of attachment content as byte[].

Specified by:
getAsBytes in interface Attachment
Returns:
first length bytes of attachment content.

getAsStream

public java.io.InputStream getAsStream()
Description copied from interface: Attachment
get attachment content for streaming.

Specified by:
getAsStream in interface Attachment
Returns:
a stream for reading the attachment.

dispose

public void dispose()
Description copied from interface: Attachment
called to denote that this attachment is not needed anymore and used resources can be released.

Specified by:
dispose in interface Attachment

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

SMILA 1.0 API documentation