AbstractParser's logic used to determine if the read buffer needs to be refilled AND the refillBuffer operations overload the use of "running" and can lead to parse operations ending prematurely.
There exist two situations to watch for:
- Have we exhausted the input source (e.g. stream), if so during a refill buffer, don't read from it.
- Has stop() been called, if so, exit the parse method.
Right now when -1 is encountered from the refillBuffer, state is changed to stopped right away when there may be remaining bytes in the buffer, especially when the refillBufferThreshold value is very high and causes frequent refill requests while a lot of data may remain in the buffer.