On 5/10/10 3:56 AM, Stanley Ding wrote:
> Here is the core decoding code:
>   
Can you give us a bit more context?

> My question is: what's gonna happen when the current buffer has only 2 bytes 
> but the "state" needs 4 bytes to decode? the state can't consume 1 byte so an 
> IllegalStateException will be thrown out?
>   
Yes. In any case, you have to deal with buffer fragmentation. The core
idea is to handle the incoming data as if it arrives byte by byte. Doing
so, you'll cover all the use cases.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com


Reply via email to