directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Vermillard <>
Subject Re: Problem with decode method and ByteBuffer size...
Date Thu, 19 May 2005 16:17:32 GMT
Le jeudi 19 mai 2005 à 14:50 +0200, Artur Edward a écrit :
> Hello !
>   I have two question. First is how do I need to proceed, if my
> "ProtocolDecoder" implementation's "decode" method is invoked with
> "ByteBuffer in" totally filled, but containing for example five full
> objects and part of the sixth ?
>   I was thinking to keep this sixth element's part as session's
> attachement and to look for it each time at the beginning of the
> "decode" method. Is this approach reasonable ?
look at CumulativeProtocolDecoder everything is there for do that :

loop for each message object you find and "write" it to the output.
If some chunk of message are remainning in the buffer, just return false
and the remaining bytes will be added to next Decoder call.

It's very convenient.


View raw message