Data reading logic for streams.