Three-state check to detect stream end.