|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.filter.codec.ProtocolDecoderAdapter
org.apache.mina.filter.codec.CumulativeProtocolDecoder
org.apache.qpid.codec.AMQDecoder
public class AMQDecoder
AMQDecoder delegates the decoding of AMQP either to a data block decoder, or in the case of new connections, to a protocol initiation decoder. It is a cumulative decoder, which means that it can accumulate data to decode in the buffer until there is enough data to decode.
One instance of this class is created per session, so any changes or configuration done at run time to the decoder will only affect decoding of the protocol session data to which is it bound.Responsibilities | Collaborations |
---|---|
Delegate protocol initiation to its decoder. | ProtocolInitiation.Decoder
|
Delegate AMQP data to its decoder. | AMQDataBlockDecoder
|
Accept notification that protocol initiation has completed. |
Constructor Summary | |
---|---|
AMQDecoder(boolean expectProtocolInitiation,
AMQVersionAwareProtocolSession session)
Creates a new AMQP decoder. |
Method Summary | |
---|---|
void |
decode(org.apache.mina.common.IoSession session,
org.apache.mina.common.ByteBuffer in,
org.apache.mina.filter.codec.ProtocolDecoderOutput out)
Cumulates content of in into internal buffer and forwards decoding request to doDecode(IoSession, ByteBuffer, ProtocolDecoderOutput) . |
ArrayList<AMQDataBlock> |
decodeBuffer(ByteBuffer buf)
|
void |
dispose(org.apache.mina.common.IoSession session)
Releases the cumulative buffer used by the specified session. |
protected boolean |
doDecode(org.apache.mina.common.IoSession session,
org.apache.mina.common.ByteBuffer in,
org.apache.mina.filter.codec.ProtocolDecoderOutput out)
Delegates decoding AMQP from the data buffer that Mina has retrieved from the wire, to the data or protocol intiation decoders. |
protected boolean |
doDecodeDataBlock(org.apache.mina.common.IoSession session,
org.apache.mina.common.ByteBuffer in,
org.apache.mina.filter.codec.ProtocolDecoderOutput out)
Decodes AMQP data, delegating the decoding to an AMQDataBlockDecoder . |
void |
setExpectProtocolInitiation(boolean expectProtocolInitiation)
Sets the protocol initation flag, that determines whether decoding is handled by the data decoder of the protocol initation decoder. |
Methods inherited from class org.apache.mina.filter.codec.ProtocolDecoderAdapter |
---|
finishDecode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AMQDecoder(boolean expectProtocolInitiation, AMQVersionAwareProtocolSession session)
expectProtocolInitiation
- true if this decoder needs to handle protocol initiation.Method Detail |
---|
protected boolean doDecode(org.apache.mina.common.IoSession session, org.apache.mina.common.ByteBuffer in, org.apache.mina.filter.codec.ProtocolDecoderOutput out) throws Exception
doDecode
in class org.apache.mina.filter.codec.CumulativeProtocolDecoder
session
- The Mina session.in
- The raw byte buffer.out
- The Mina object output gatherer to write decoded objects to.
Exception
- If the data cannot be decoded for any reason.protected boolean doDecodeDataBlock(org.apache.mina.common.IoSession session, org.apache.mina.common.ByteBuffer in, org.apache.mina.filter.codec.ProtocolDecoderOutput out) throws Exception
AMQDataBlockDecoder
.
session
- The Mina session.in
- The raw byte buffer.out
- The Mina object output gatherer to write decoded objects to.
Exception
- If the data cannot be decoded for any reason.public void setExpectProtocolInitiation(boolean expectProtocolInitiation)
expectProtocolInitiation
- true to use the protocol initiation decoder, false to use the
data decoder.public void decode(org.apache.mina.common.IoSession session, org.apache.mina.common.ByteBuffer in, org.apache.mina.filter.codec.ProtocolDecoderOutput out) throws Exception
doDecode(IoSession, ByteBuffer, ProtocolDecoderOutput)
.
doDecode() is invoked repeatedly until it returns false
and the cumulative buffer is compacted after decoding ends.
decode
in interface org.apache.mina.filter.codec.ProtocolDecoder
decode
in class org.apache.mina.filter.codec.CumulativeProtocolDecoder
IllegalStateException
- if your doDecode() returned
true not consuming the cumulative buffer.
Exception
public void dispose(org.apache.mina.common.IoSession session) throws Exception
dispose
in interface org.apache.mina.filter.codec.ProtocolDecoder
dispose
in class org.apache.mina.filter.codec.CumulativeProtocolDecoder
Exception
public ArrayList<AMQDataBlock> decodeBuffer(ByteBuffer buf) throws AMQFrameDecodingException, AMQProtocolVersionException
AMQFrameDecodingException
AMQProtocolVersionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |