org.apache.mina.protocol.codec
Interface MessageDecoder


public interface MessageDecoder

Decodes specific messages.

Version:
$Rev: 332218 $, $Date: 2005-11-10 12:52:42 +0900 $
Author:
The Apache Directory Project (dev@directory.apache.org)
See Also:
DemuxingProtocolCodecFactory, MessageDecoderFactory

Field Summary
static MessageDecoderResult NEED_DATA
          Represents a result from decodable(ProtocolSession, ByteBuffer) and decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput).
static MessageDecoderResult NOT_OK
          Represents a result from decodable(ProtocolSession, ByteBuffer) and decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput).
static MessageDecoderResult OK
          Represents a result from decodable(ProtocolSession, ByteBuffer) and decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput).
 
Method Summary
 MessageDecoderResult decodable(ProtocolSession session, ByteBuffer in)
          Checks the specified buffer is decodable by this decoder.
 MessageDecoderResult decode(ProtocolSession session, ByteBuffer in, ProtocolDecoderOutput out)
          Decodes binary or protocol-specific content into higher-level message objects.
 

Field Detail

OK

static final MessageDecoderResult OK
Represents a result from decodable(ProtocolSession, ByteBuffer) and decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput). Please refer to each method's documentation for detailed explanation.


NEED_DATA

static final MessageDecoderResult NEED_DATA
Represents a result from decodable(ProtocolSession, ByteBuffer) and decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput). Please refer to each method's documentation for detailed explanation.


NOT_OK

static final MessageDecoderResult NOT_OK
Represents a result from decodable(ProtocolSession, ByteBuffer) and decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput). Please refer to each method's documentation for detailed explanation.

Method Detail

decodable

MessageDecoderResult decodable(ProtocolSession session,
                               ByteBuffer in)
Checks the specified buffer is decodable by this decoder.

Returns:
OK if this decoder can decode the specified buffer. NOT_OK if this decoder cannot decode the specified buffer. NEED_DATA if more data is required to determine if the specified buffer is decodable (OK) or not decodable NOT_OK.

decode

MessageDecoderResult decode(ProtocolSession session,
                            ByteBuffer in,
                            ProtocolDecoderOutput out)
                            throws ProtocolViolationException
Decodes binary or protocol-specific content into higher-level message objects. MINA invokes decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput) method with read data, and then the decoder implementation puts decoded messages into ProtocolDecoderOutput.

Returns:
OK if you finished decoding messages successfully. NEED_DATA if you need more data to finish decoding current message. NOT_OK if you cannot decode current message due to protocol specification violation.
Throws:
ProtocolViolationException - if the read data violated protocol specification


Copyright © 2004-2005 . All Rights Reserved.