org.apache.mina.examples.sumup.codec
Class AbstractMessageDecoder
java.lang.Object
org.apache.mina.examples.sumup.codec.AbstractMessageDecoder
- All Implemented Interfaces:
- MessageDecoder
- Direct Known Subclasses:
- AddMessageDecoder, ResultMessageDecoder
public abstract class AbstractMessageDecoder
- extends Object
- implements MessageDecoder
A MessageDecoder
that decodes message header and forwards
the decoding of body to a subclass.
- Version:
- $Rev: 264677 $, $Date: 2005-08-30 11:44:35 +0900 $
- Author:
- The Apache Directory Project
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractMessageDecoder
protected AbstractMessageDecoder(int type)
decodable
public MessageDecoderResult decodable(ProtocolSession session,
ByteBuffer in)
- Description copied from interface:
MessageDecoder
- Checks the specified buffer is decodable by this decoder.
- Specified by:
decodable
in interface MessageDecoder
- Returns:
MessageDecoder.OK
if this decoder can decode the specified buffer.
MessageDecoder.NOT_OK
if this decoder cannot decode the specified buffer.
MessageDecoder.NEED_DATA
if more data is required to determine if the
specified buffer is decodable (MessageDecoder.OK
) or not decodable
MessageDecoder.NOT_OK
.
decode
public MessageDecoderResult decode(ProtocolSession session,
ByteBuffer in,
ProtocolDecoderOutput out)
throws ProtocolViolationException
- Description copied from interface:
MessageDecoder
- Decodes binary or protocol-specific content into higher-level message objects.
MINA invokes
MessageDecoder.decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded
messages into ProtocolDecoderOutput
.
- Specified by:
decode
in interface MessageDecoder
- Returns:
MessageDecoder.OK
if you finished decoding messages successfully.
MessageDecoder.NEED_DATA
if you need more data to finish decoding current message.
MessageDecoder.NOT_OK
if you cannot decode current message due to protocol specification violation.
- Throws:
ProtocolViolationException
- if the read data violated protocol
specification
decodeBody
protected abstract AbstractMessage decodeBody(ProtocolSession session,
ByteBuffer in)
- Returns:
- null if the whole body is not read yet
Copyright © 2004-2005 . All Rights Reserved.