Fixed issue: NETTY-187 Subsitute ReplayingDecoder with FrameDecoder without losing stored buffer
* Added ReplayingDecoder.actualReadableBytes()
This commit is contained in:
parent
81cb42f37e
commit
142bce4560
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user