com.mooapi.common.message
Class IntegerMessage

java.lang.Object
  extended by com.mooapi.common.message.AbstractMessage<T>
      extended by com.mooapi.common.message.AbstractTypedMessage<java.lang.Integer>
          extended by com.mooapi.common.message.IntegerMessage

public class IntegerMessage
extends AbstractTypedMessage<java.lang.Integer>

Integer message base type.

Author:
Steve Taylor

Constructor Summary
IntegerMessage(java.lang.Integer message)
          Wrap the specified integer.
 
Method Summary
 RawMessage asRawMessage()
          Convert this message into a raw message.
static IntegerMessage decode(org.apache.mina.common.ByteBuffer message)
          Decode the integer message, including the leading type byte.
protected  org.apache.mina.common.ByteBuffer encodeBody()
          Encode the integer, excluding the leading type byte.
 int getEncodedLength()
          Get the length, in bytes, of this message when encoded.
 MessageType getType()
          Get this message's type.
 
Methods inherited from class com.mooapi.common.message.AbstractTypedMessage
encode, equals, hashCode, toString
 
Methods inherited from class com.mooapi.common.message.AbstractMessage
getMessage
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerMessage

public IntegerMessage(java.lang.Integer message)
Wrap the specified integer.

Parameters:
message - An integer.
Method Detail

getType

public MessageType getType()
Description copied from class: AbstractTypedMessage
Get this message's type.

Specified by:
getType in class AbstractTypedMessage<java.lang.Integer>
Returns:
The type.

decode

public static IntegerMessage decode(org.apache.mina.common.ByteBuffer message)
Decode the integer message, including the leading type byte.

Parameters:
message - The bytes to decode.
Returns:
The decoded message.
Throws:
java.lang.IllegalArgumentException - if the leading type byte is not MessageType.INTEGER.
java.nio.BufferUnderflowException - if there are insufficient bytes in the encoded message.

getEncodedLength

public int getEncodedLength()
Description copied from class: AbstractMessage
Get the length, in bytes, of this message when encoded.

Specified by:
getEncodedLength in class AbstractMessage<java.lang.Integer>
Returns:

encodeBody

protected org.apache.mina.common.ByteBuffer encodeBody()
Encode the integer, excluding the leading type byte.

Specified by:
encodeBody in class AbstractTypedMessage<java.lang.Integer>
Returns:
The encoded integer.

asRawMessage

public RawMessage asRawMessage()
Convert this message into a raw message.

Specified by:
asRawMessage in class AbstractMessage<java.lang.Integer>
Returns:
A new raw message.


Copyright © 2009. All Rights Reserved.