mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee" <trus...@gmail.com>
Subject Re: MessageDecoderResult.OK
Date Tue, 02 Oct 2007 12:56:23 GMT
On 10/2/07, mat <forum.maillist@gmail.com> wrote:
> After MessageDecoderResult.OK in decode(), what mina handle ByteBuffer
> in? Remove the remaining byte[] in ByteBuffer to new position? Or ByteBuffer
> has special function can do this?

It often retains the reference to the buffer calling compact() and
flip().  It sometimes replaces the buffer received from the previous
filter in the chain.  It's because the decoder implementation is
optimized to minimize memory copy.  So you can't assume about its
internal behavior.  Please do not try to modify the content of the
buffer (e.g. calling buffer.compact()); MINA will do that for you.
Plus, please do not assume that the buffer's position is always 0.  It
can vary depending on situation.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Mime
View raw message