Isn't this causing the off-by-one error in the line count with random data? Because if it doesn't end with a new line I'm not sure what you get here, maybe it wouldn't return you the content after the last LF? Seems like it does though since the byte count is correct.. quite  strange.