net.gleamynode.netty2
Interface MessageRecognizer
- public interface MessageRecognizer
Converts ByteBuffer
into 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/)
recognize
public Message recognize(ByteBuffer buffer)
throws MessageParseException
- Converts
ByteBuffer
into 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-2006 Trustin Lee. All Rights Reserved.