ch.epfl.lpd.ids.serialization
Class Message

java.lang.Object
  extended by ch.epfl.lpd.ids.serialization.Message
All Implemented Interfaces:
IMessage, Serializable

public class Message
extends Object
implements IMessage

Class implementing the IMessage specification.

Author:
Sebastien Baehni
See Also:
Serialized Form

Field Summary
protected  byte[] data
          The data of the message.
protected  String header
          The header of the message.
 
Constructor Summary
Message(String header, byte[] data)
          Creates a new instance of Message.
 
Method Summary
 byte[] getData()
          Method used to retrieve the data of the message.
 String getHeader()
          Method used to retrieved the header of the message.
 void setData(byte[] data)
          Method used to set the data of the message.
 void setHeader(String header)
          Method used to set the header of the message.
 String toString()
          Method used to print this message as a string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

header

protected String header
The header of the message.


data

protected byte[] data
The data of the message.

Constructor Detail

Message

public Message(String header,
               byte[] data)
Creates a new instance of Message. This instance sets the header and the data of the message.

Parameters:
header - The header of the message.
data - The data of the message.
Method Detail

getHeader

public String getHeader()
Method used to retrieved the header of the message.

Specified by:
getHeader in interface IMessage
Returns:
The header of the message.

setHeader

public void setHeader(String header)
Method used to set the header of the message.

Specified by:
setHeader in interface IMessage
Parameters:
header - The header of the message.

getData

public byte[] getData()
Method used to retrieve the data of the message.

Specified by:
getData in interface IMessage
Returns:
The data of the message.

setData

public void setData(byte[] data)
Method used to set the data of the message.

Specified by:
setData in interface IMessage
Parameters:
data - An array of bytes representing the data of the message.

toString

public String toString()
Method used to print this message as a string representation.

Overrides:
toString in class Object
Returns:
The string representation of this message.