Fixed issue: NETTY-187 Subsitute ReplayingDecoder with FrameDecoder without losing stored buffer

* Added ReplayingDecoder.actualReadableBytes()
This commit is contained in:
Trustin Lee 2009-07-06 11:32:01 +00:00
parent 81cb42f37e
commit 142bce4560

View File

@ -324,7 +324,21 @@ public abstract class ReplayingDecoder<T extends Enum<T>>
state = newState;
return oldState;
}
/**
* Returns the actual number of readable bytes in the cumulative buffer
* of this decoder. You do not need to rely on this value to write a
* decoder. Use it only when necessary.
*/
protected int actualReadableBytes() {
ChannelBuffer buf = cumulation.get();
if (buf == null) {
return 0;
}
return buf.readableBytes();
}
/**
* Decodes the received packets so far into a frame.
*