Reading content line by line from a file or standard input while supporting multiple file descriptors.