net.gleamynode.netty2
Interface MessageRecognizer


public interface MessageRecognizer

Converts ByteBufferinto Message. I/O worker thread calls recognize(ByteBuffer)first to determine the proper Message, and then it calls corresponding Message's Message.read(ByteBuffer)method to generate messageReceived event.

Version:
$Rev: 4 $, $Date: 2005-04-18 12:04:09 +0900 $
Author:
Trustin Lee (http://gleamynode.net/dev/)

Method Summary
 Message recognize(ByteBuffer buffer)
          Converts ByteBufferinto Message.
 

Method Detail

recognize

Message recognize(ByteBuffer buffer)
                  throws MessageParseException
Converts ByteBufferinto Message.

Parameters:
buffer - incoming bytes
Returns:
the converted message only if this recognizer understands the incoming data. null otherwise (i.e. the recognizer cannot determine the message type because the incoming data is too small yet.)
Throws:
MessageParseException - if this recognizer does not understand the incoming data, or if the validation is failed.


Copyright © 2004-2008 Trustin Lee. All Rights Reserved.