Like readline or split, but behaves more like ruby's .each_with_index method when streams lack trailing newlines.