rescuecore
Class LongUDPMessage

java.lang.Object
  extended byrescuecore.LongUDPMessage

public class LongUDPMessage
extends java.lang.Object

This class encapsulates a long UDP message, as defined by the robocup rescue manual version 0.4


Field Summary
static int CHUNK_SIZE
           
 
Constructor Summary
LongUDPMessage(byte[] data)
          Construct a new LongUDPMessage containing the given data
 
Method Summary
static LongUDPMessage defragment(LongUDPFragment[] fragments)
          Defragment a set of LongUDPFragments into one LongUDPMessage
 LongUDPFragment[] fragment(short id)
          Break up this message into fragments ready for sending
 byte[] getData()
          Get the body of this message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHUNK_SIZE

public static final int CHUNK_SIZE
See Also:
Constant Field Values
Constructor Detail

LongUDPMessage

public LongUDPMessage(byte[] data)
Construct a new LongUDPMessage containing the given data

Parameters:
data - The body of the message
Method Detail

fragment

public LongUDPFragment[] fragment(short id)
Break up this message into fragments ready for sending

Parameters:
id - The id number assigned to each fragment
Returns:
An array of LongUDPFragments that can be sent to the kernal

getData

public byte[] getData()
Get the body of this message

Returns:
The message body

defragment

public static LongUDPMessage defragment(LongUDPFragment[] fragments)
Defragment a set of LongUDPFragments into one LongUDPMessage

Parameters:
fragments - The fragmented message to reassemble
Returns:
A new LongUDPMessage that has been assembled from the given fragments. If there is a problem, then null is returned.