com.inspirel.yami
Class RawBinaryDataSource

java.lang.Object
  extended by com.inspirel.yami.RawBinaryDataSource
All Implemented Interfaces:
YAMISerializable

public class RawBinaryDataSource
extends java.lang.Object
implements YAMISerializable

Serializable wrapper for the raw binary data. Serializable wrapper for the raw binary data allows to use already serialized content for message sending. The two major use cases for this class are efficient message forwarding (when the message is received and its content is used for another message) and support for custom data models and serializers.


Constructor Summary
RawBinaryDataSource(byte[] buffer)
          Constructor.
 
Method Summary
 java.util.List<byte[]> serialize(int chunkSize)
          Serializes the content of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawBinaryDataSource

public RawBinaryDataSource(byte[] buffer)
Constructor. Wraps the given binary buffer.

Parameters:
buffer - binary buffer to be wrapped
Method Detail

serialize

public java.util.List<byte[]> serialize(int chunkSize)
Serializes the content of this object.

The content is serialized into chunks of the given size, after serialization only the last chunk can be smaller than the requested size.

Specified by:
serialize in interface YAMISerializable
Parameters:
chunkSize - chunk size, should be a multiple of 4 or Integer.MAX_VALUE
Returns:
list of buffers (chunks) with serialized data
Throws:
java.lang.IllegalArgumentException - if requested chunk size is not a multiple of 4 and is not Integer.MAX_VALUE