On 9/28/07, immars <[EMAIL PROTECTED]> wrote:
>
> Hello,
> I implemented CumulativeProtocolDecoder.doDecode() in my subclass of
> CumulativeProtocolDecoder.
> In my doDecode(), the most straight-forward way I could figure out of
> decoding data is reading fields(Integers, Bytes, Booleans, etc.) of my POJO
> step by step following the protocol, until the work is done or an
> java.nio.BufferUnderflowException is thrown, which means data not sufficient
> for decoding. In the later case, I reset the ByteBuffer to the previous
> position before invocation of doDecode().
>
> So I keep thinking that this exception handling aspect should be done by a
> super class of many real-protocol concerned decoders, maybe the
> CumulativeProtocolDecoder itself.
>
> Here's a example patch to describe my idea:
>
> http://www.nabble.com/file/p12938622/CPD.patch CPD.patch

Thank you so much for your suggestion.  However, wouldn't it be very
inefficient if you rely on exceptions?

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

Reply via email to