Your implementation calls for the use of CumulativeProtocolDecoder.
TextLineDecoder example in MINA does the same.

Alternatively look at the XML Decoder thread, which has similar implementation

Check out the thread
http://www.nabble.com/MINA---design-guidelines-tt20077627.html#a20149291

-- 
thanks
ashish

Blog: http://www.ashishpaliwal.com/blog

My Photo Galleries: http://www.pbase.com/ashishpaliwal

On Wed, Nov 5, 2008 at 1:02 AM, lester sonemann <[EMAIL PROTECTED]> wrote:
> Being new to MINA, I'm really struggling with the following issue:
>
> I need to be able to stack protocol codecs to be able to perform the
> following functions:
>
> 1. First obtain a ByteBuffer that contains all bytes to be decoded into a
> message object
> 2. Decode the ByteBuffer obtained in step 1 into an Object of some sort.
>
> The reason for doing this is that the way that a 'packet' of data is
> obtained in step 1 may differ for different NioSocketAdapters, and the
> decoding in step 2 will very definitely differ for different
> NioSocketAcceptors.  For example, I might have a 2-byte header for step 1 in
> some cases, and a STX---ETX delimited 'packet' in others.  In step 2, I may
> want to decode to an ImageRequest object, and in other cases, to a
> ReversedString object, or whatever.  So it would be nice to split the
> 'packetisation' of the incoming stream from the decoding into an object.
>
> I think I have a reasonable understanding of ProtocolCodecFactory and
> ProtocolDecoder and ProtocolDecoder, but can simply not get to the point
> where I can pass the data received from a client through two as indicated
> above.  I have trawled similar issues reported in the past, with no luck.
>
> Any help on this would be highly appreciated.
>

Reply via email to