int movePos ( int requiredForFlushing , int requiredForFinishing ) { assert requiredForFlushing >= requiredForFinishing ; ++ readPos ; int avail = writePos - readPos ; if ( avail < requiredForFlushing ) { if ( avail < requiredForFinishing || ! finishing ) { ++ pendingSize ; avail = 0 ; } } return avail ; }
Moves to the next byte checks if there is enough input available and returns the amount of input available .