cgl.narada.transport.sslHttpBase
Class LinkMessage

java.lang.Object
  extended by cgl.narada.transport.sslHttpBase.LinkMessage
Direct Known Subclasses:
LinkMessageCommand, LinkMessageKeepAlive, LinkMessagePerf

public class LinkMessage
extends Object

Header fields for a message on a channel. Provides serialization utilities

Version:
1.0

Field Summary
static byte TRANSPORT_DATA_TYPE
           
 
Constructor Summary
LinkMessage()
          -------------------------------------------------------------------
LinkMessage(String channelID)
          -------------------------------------------------------------------
LinkMessage(String channelID, byte[] payload)
          ------------------------------------------------------------------- Create a new channel message.
 
Method Summary
static int exportString(byte[] buffer, int startIndex, String string)
          -------------------------------------------------------------------
 String getLinkID()
          -------------------------------------------------------------------
 byte getMessageType()
          ------------------------------------------------------------------- One of TRANSPOT_DATA_TYPE, or user defined type.
 byte[] getPayload()
          -------------------------------------------------------------------
static String importString(byte[] buffer, int startIndex)
          -------------------------------------------------------------------
static void main(String[] args)
          ------------------------------------------------------------------- Unit Test
 void parseData(byte[] data)
          -------------------------------------------------------------------
 void setMessageType(byte type)
          ------------------------------------------------------------------- Sets the message type flag.
 void setPayload(byte[] payload)
          -------------------------------------------------------------------
 byte[] toBytes()
          ------------------------------------------------------------------- Convert the message to a byte array for transfer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSPORT_DATA_TYPE

public static final byte TRANSPORT_DATA_TYPE
See Also:
Constant Field Values
Constructor Detail

LinkMessage

public LinkMessage()
-------------------------------------------------------------------


LinkMessage

public LinkMessage(String channelID)
-------------------------------------------------------------------


LinkMessage

public LinkMessage(String channelID,
                   byte[] payload)
------------------------------------------------------------------- Create a new channel message. Typically used for writing.

Method Detail

setMessageType

public void setMessageType(byte type)
------------------------------------------------------------------- Sets the message type flag. Values of 10 or below are reserved.


getMessageType

public byte getMessageType()
------------------------------------------------------------------- One of TRANSPOT_DATA_TYPE, or user defined type.


setPayload

public void setPayload(byte[] payload)
-------------------------------------------------------------------


getLinkID

public String getLinkID()
-------------------------------------------------------------------


getPayload

public byte[] getPayload()
-------------------------------------------------------------------


toBytes

public byte[] toBytes()
------------------------------------------------------------------- Convert the message to a byte array for transfer. 1st byte is always the message type.


parseData

public void parseData(byte[] data)
               throws IOException
-------------------------------------------------------------------

Throws:
IOException

exportString

public static int exportString(byte[] buffer,
                               int startIndex,
                               String string)
-------------------------------------------------------------------

Returns:
The length of the exports in bytes.

importString

public static String importString(byte[] buffer,
                                  int startIndex)
                           throws IOException
-------------------------------------------------------------------

Throws:
IOException

main

public static void main(String[] args)
                 throws IOException
------------------------------------------------------------------- Unit Test

Throws:
IOException


For comments and suggestions please send e-mail to The NaradaBrokering Project