public class RawMessage
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static int |
HEADER_SIZE
The size of the header of this message object.
|
| Modifier | Constructor and Description |
|---|---|
|
RawMessage(byte[] binaryMessageBytes)
Creates a message object from the given byte array.
|
|
RawMessage(byte[] binaryMessageBytes,
int offset)
Same as
RawMessage(byte[]) but from the given byte array the offset (starting part) is ignored. |
|
RawMessage(byte[] binaryMessageBytes,
int offset,
int length)
Creates a message object by the given byte array (which includes the header).
|
|
RawMessage(int kind)
Creates an empty message object of a certain kind.
|
|
RawMessage(int kind,
byte[] data)
Creates a message object of a certain kind and with the given data.
|
protected |
RawMessage(RawMessage original,
int numberOfPackets,
int currentPacketNumber,
int offset,
int length)
Constructor used for message splitting.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getBroadcastMethod() |
long |
getClusterIslandPK() |
int |
getCurrentPacketNumber()
Return the current packet number which is never greater than
getNumberOfPackets(). |
byte[] |
getData() |
long |
getDynamicNodeID()
Cluster island PK + dynamic node ID is unique for identifying a single node in several clusters.
|
int |
getKind()
The kind of this RawMessage.
|
java.lang.Object |
getMessageKey()
Returns the message key which is an unique identifier for all messages in all clusters
|
int |
getMessageNumber()
Cluster island PK + dynamic node ID + message number is unique for identifying a single message in several
clusters with many nodes.
|
int |
getNumberOfPackets()
Indicates if this
RawMessage is a splitted message (value > 1) or not. |
java.net.InetAddress |
getRemoteAddress() |
int |
getVersion()
Returns the version of the RawMessage header.
|
RawMessage |
join(java.util.Collection<RawMessage> messageparts)
Joins the current RawMessage (this) with the given list of RawMessages into a new joined RawMessage.
|
boolean |
matches(int version,
long clusterisland)
TODO apidoc
|
boolean |
matches(RawMessage other)
TODO apidoc
|
boolean |
mustSplit(int packetsize)
Returns
true if the resulting RawMessage (data+header) exceed the given packet size. |
void |
setBroadcastMethod(java.lang.String broadcastMethod) |
void |
setPacketSplitInfo(int currentPacketNumber,
int numberOfPackets)
Sets the header information when the message is splitted into several parts.
|
void |
setReceiverTransportData(java.net.InetAddress remoteAdress)
TODO apidoc
|
void |
setRemoteAddress(java.net.InetAddress remoteAddress) |
void |
setSenderTransportData(int version,
long clusterIsland,
long dynamicNodeID,
int messageNumber)
Sets the important header informations for this message.
|
java.util.List<RawMessage> |
split(int packetSize)
Splits the current RawMessage (this) into several RawMessages which are the same size or less (including the
header) as the given packet size.
|
byte[] |
toRawByteArray() |
java.lang.String |
toString()
[broadcastMethod://remoteAddress|ver:version|clusterislandid-dynamicnodeid-<
/b> messageid| kind|packetnummerofpackets (content: contentlength bytes)]
|
public static final int HEADER_SIZE
| version | cluster island id | dynamic node id | message number | kind | message part number | message part count |
|---|---|---|---|---|---|---|
| 4 byte | 8 byte | 8 byte | 4 byte | 4 byte | 4 byte | 4 byte |
protected RawMessage(RawMessage original, int numberOfPackets, int currentPacketNumber, int offset, int length)
original - the original message object. Contains all necessary datas.numberOfPackets - the new number of packetscurrentPacketNumber - the new current packet numberoffset - the starting point for copying the original data into this objectlength - the length of the data which is copied into this objectpublic RawMessage(int kind)
kind - the kind of the message.public RawMessage(int kind,
byte[] data)
kind - the kind of the message.data - the data contentpublic RawMessage(byte[] binaryMessageBytes)
binaryMessageBytes - the byte array which includes the header and the contentpublic RawMessage(byte[] binaryMessageBytes,
int offset)
RawMessage(byte[]) but from the given byte array the offset (starting part) is ignored.binaryMessageBytes - the byte array which includes the header and the contentoffset - the starting pointpublic RawMessage(byte[] binaryMessageBytes,
int offset,
int length)
binaryMessageBytes - a byte array which contains a message objectoffset - start point of the message object in the byte arraylength - the length of the message object in the byte array, starting at the offsetjava.lang.IllegalArgumentException - if length or offset is negative and if ayyay is smaller than offset+lengthpublic void setSenderTransportData(int version,
long clusterIsland,
long dynamicNodeID,
int messageNumber)
version - the version of the messageclusterIsland - the cluster island IDdynamicNodeID - the dynamic node IDmessageNumber - the message numberpublic void setPacketSplitInfo(int currentPacketNumber,
int numberOfPackets)
currentPacketNumber - the current packet number, mustn't be negative and less or equal as the number of packets. Default value
is 1.numberOfPackets - the number of packets, mustn't be negative. Default value is 1.public void setReceiverTransportData(java.net.InetAddress remoteAdress)
remoteAdress - public int getVersion()
DefaultBroadcastService.CUR_VERSION
| int value | hexadecimal view | string view |
|---|---|---|
| 67174656 | 4010100 | 4.1.1.0 |
public long getClusterIslandPK()
public long getDynamicNodeID()
public int getMessageNumber()
public int getNumberOfPackets()
RawMessage is a splitted message (value > 1) or not.public int getCurrentPacketNumber()
getNumberOfPackets(). Default value is 1.public int getKind()
BroadcastMessageListener interface more different values for this
kind getter are possible.public byte[] getData()
public boolean matches(int version,
long clusterisland)
version - clusterisland - public boolean matches(RawMessage other)
other - public java.lang.String toString()
toString in class java.lang.Objectpublic java.net.InetAddress getRemoteAddress()
public void setRemoteAddress(java.net.InetAddress remoteAddress)
remoteAddress - the remoteAddress to setpublic java.lang.String getBroadcastMethod()
public void setBroadcastMethod(java.lang.String broadcastMethod)
broadcastMethod - the broadcastMethod to setpublic java.lang.Object getMessageKey()
public boolean mustSplit(int packetsize)
true if the resulting RawMessage (data+header) exceed the given packet size.packetsize - the packet sizefalse otherwisepublic java.util.List<RawMessage> split(int packetSize)
packetSize - the packet sizeArrayList which contains the splitted RawMessage, each message is in the size of the
given packet size.public RawMessage join(java.util.Collection<RawMessage> messageparts)
messageparts - a list with other partsnull or emptypublic byte[] toRawByteArray()
Copyright © 2018 SAP SE. All Rights Reserved.