ist.palcom.rascal
Class RascalMessage

java.lang.Object
  extended by ist.palcom.rascal.RascalMessage

public class RascalMessage
extends java.lang.Object

Envelop of a PalCom message which includes the URN/URL/Selectors of the receiver/sender.


Constructor Summary
RascalMessage(URN urn, Message msg)
           
 
Method Summary
 Message getMessage()
           
 int getTotalLength()
           
 URN getURN()
           
static RascalMessage parse(byte[] data, int offset, int length)
          Factory method for parsing a Rascal Message from a byte array.
 int write(byte[] buffer, int offset)
          Write the RASCAL message to a buffer, starting at index offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RascalMessage

public RascalMessage(URN urn,
                     Message msg)
Method Detail

getTotalLength

public int getTotalLength()

write

public int write(byte[] buffer,
                 int offset)
Write the RASCAL message to a buffer, starting at index offset.

Returns:
The number of bytes written.
Throws:
java.lang.IndexOutOfBoundsException - if the buffer is too small.

parse

public static RascalMessage parse(byte[] data,
                                  int offset,
                                  int length)
Factory method for parsing a Rascal Message from a byte array. The parsing starts at offset and parses to the end of a message, or at most length bytes.

Returns:
The message read, or null if no message could be read.

getMessage

public Message getMessage()

getURN

public URN getURN()