mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Ding <gh_a...@hotmail.com>
Subject DecodingStateProtocolDecoder's problem
Date Mon, 10 May 2010 01:56:59 GMT

Here is the core decoding code:

 

for (;;) {
            IoBuffer b = undecodedBuffers.peek();
            if (b == null) {
                break;
            }

            int oldRemaining = b.remaining();
            state.decode(b, out);
            int newRemaining = b.remaining();
            if (newRemaining != 0) {
                if (oldRemaining == newRemaining) {
                    throw new IllegalStateException(
                            DecodingState.class.getSimpleName() + " must " +
                            "consume at least one byte per decode().");
                }
            } else {
                undecodedBuffers.poll();
            }
}

 

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?
 		 	   		  
_________________________________________________________________
Hotmail: Free, trusted and rich email service.
https://signup.live.com/signup.aspx?id=60969
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message