Package org.somda.sdc.dpws.udp
Class UdpMessage
-
- All Implemented Interfaces:
public class UdpMessageRaw UDP message packed as a byte array plus a length attribute and receiver information.
-
-
Field Summary
Fields Modifier and Type Field Description public final intlengthpublic final Array<byte>datapublic final CommunicationContextcommunicationContext
-
Constructor Summary
Constructors Constructor Description UdpMessage(Array<byte> data, int length, CommunicationContext communicationContext)Constructor with transport information. UdpMessage(Array<byte> data, int length)Constructor without transport information.
-
Method Summary
Modifier and Type Method Description intgetLength()Array<byte>getData()Gets the data from this object as byte array. CommunicationContextgetCommunicationContext()Returns the communication context stored in this message. booleanhasTransportData()Checks if there is transport data attached to the message. IntegergetPort()StringgetHost()StringtoString()-
-
Constructor Detail
-
UdpMessage
UdpMessage(Array<byte> data, int length, CommunicationContext communicationContext)
Constructor with transport information.- Parameters:
data- the payload of the UDP message.length- the actual message length.communicationContext- message transport and application information.
-
UdpMessage
UdpMessage(Array<byte> data, int length)
Constructor without transport information.- Parameters:
data- the payload of the UDP message.length- the actual message length.
-
-
Method Detail
-
getLength
int getLength()
-
getData
Array<byte> getData()
Gets the data from this object as byte array.
Do not rely on the byte array's length attribute, retrieve the length via getLength instead!
- Returns:
message byte array.
-
getCommunicationContext
CommunicationContext getCommunicationContext()
Returns the communication context stored in this message.
- Returns:
communication context containing transport information and more.
-
hasTransportData
boolean hasTransportData()
Checks if there is transport data attached to the message.
- Returns:
true if there is a host and port, otherwise false.
-
-
-
-