public class DataMessage extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_MESSAGE_LENGTH
Maximum length in bytes of messages that can be sent via spread.
|
Constructor and Description |
---|
DataMessage() |
Modifier and Type | Method and Description |
---|---|
void |
addGroup(String group)
Adds a group this message should be sent to.
|
void |
enableSelfDiscard()
Sets the self discard flag for this message so that it will not be
delivered to the sender by the spread daemon.
|
ByteBuffer |
getData()
Returns the data this message will contain.
|
Set<String> |
getGroups()
Returns the spread groups this message will be sent to.
|
spread.SpreadMessage |
getSpreadMessage()
Returns the constructed
SpreadMessage instance. |
boolean |
isForGroup(String name)
Tells whether this message shall be sent to the requested group.
|
void |
setData(byte[] buffer)
Sets the data to send with this message.
|
void |
setData(ByteBuffer buffer)
Sets the data to send with this message.
|
public static final int MAX_MESSAGE_LENGTH
public Set<String> getGroups()
public void addGroup(String group)
group
- the new groupIllegalArgumentException
- group name is null
, empty, or longer then
SpreadUtilities.MAX_GROUP_NAME_LENGTH
public boolean isForGroup(String name)
name
- name of the group to test fortrue
if this message will be sent to that grouppublic void setData(ByteBuffer buffer) throws SerializeException
buffer
- data buffer, not null
SerializeException
- buffer cannot be serializedpublic void setData(byte[] buffer) throws SerializeException
buffer
- data buffer, not null
SerializeException
- buffer cannot be serializedpublic ByteBuffer getData()
null
public void enableSelfDiscard()
public spread.SpreadMessage getSpreadMessage() throws SerializeException
SpreadMessage
instance.SerializeException
- message cannot be created because information is missingCopyright © 2018 CoR-Lab. All rights reserved.