org.ow2.easybeans.component.smartclient.message
Class AbsMessage

java.lang.Object
  extended by org.ow2.easybeans.component.smartclient.message.AbsMessage
All Implemented Interfaces:
Message
Direct Known Subclasses:
AbsNameBytesMessage, AbsNameMessage, ProviderURLRequest

public abstract class AbsMessage
extends java.lang.Object
implements Message

Abstract class that needs to be used for every message that are exchanged between client and endpoint.

Author:
Florent Benoit

Field Summary
 
Fields inherited from interface org.ow2.easybeans.component.smartclient.api.Message
HEADER_SIZE, INT_BYTE_SIZE
 
Constructor Summary
AbsMessage()
           
 
Method Summary
protected  java.lang.String decode(java.nio.ByteBuffer buffer)
          Decode the string encoded in the bytebuffer in UTF-8 format.
protected  java.nio.ByteBuffer encode(java.lang.String str)
          Encode the given string into a bytebuffer.
 java.nio.ByteBuffer getMessage()
          Gets a message to send.
abstract  byte getOpCode()
          Gets the OpCode of this message.
abstract  java.nio.ByteBuffer getSubMessage()
          Gets the content of this message (only this part, not the header).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbsMessage

public AbsMessage()
Method Detail

getMessage

public java.nio.ByteBuffer getMessage()
Gets a message to send.

Specified by:
getMessage in interface Message
Returns:
the bytebuffer to send

getOpCode

public abstract byte getOpCode()
Gets the OpCode of this message.

Specified by:
getOpCode in interface Message
Returns:
the operation code.

getSubMessage

public abstract java.nio.ByteBuffer getSubMessage()
Gets the content of this message (only this part, not the header).

Returns:
the content of this message.

encode

protected java.nio.ByteBuffer encode(java.lang.String str)
Encode the given string into a bytebuffer.

Parameters:
str - the given string
Returns:
a bytebuffer with UTF-8 encoded string

decode

protected java.lang.String decode(java.nio.ByteBuffer buffer)
Decode the string encoded in the bytebuffer in UTF-8 format.

Parameters:
buffer - the given buffer to analyze.
Returns:
the decoded string


Copyright © 2006-2007 OW2 Consortium. All Rights Reserved.