org.biffle.cliff.pearl
Class Message

java.lang.Object
  |
  +--org.biffle.cliff.pearl.Message

public class Message
extends java.lang.Object

Represents a Pearl protocol message. A message is identified by a type, and contains zero or more payload bytes.


Constructor Summary
Message(int type, byte[] payload)
          Creates a new message of a given type, with an optional payload.
Message(int type, byte[] payload, boolean failure)
          Creates a new message of a given type, with an optional payload, and a flag indicating whether or not it indicates failure.
 
Method Summary
 boolean failure()
          Checks whether or not this message indicates failure.
 byte[] getPayload()
          Returns the message payload.
 int getType()
          Returns the type of the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Message

public Message(int type,
               byte[] payload)
Creates a new message of a given type, with an optional payload. If payload is zero-length or null, it is ignored.


Message

public Message(int type,
               byte[] payload,
               boolean failure)
Creates a new message of a given type, with an optional payload, and a flag indicating whether or not it indicates failure. If payload is zero-length or null, it is ignored.

Method Detail

getType

public int getType()
Returns the type of the message.


getPayload

public byte[] getPayload()
Returns the message payload. This will be either null or zero-length if there is no payload.


failure

public boolean failure()
Checks whether or not this message indicates failure.