Create a generate that iterates the whole content of the file or string.

        :return: An iterator iterating the lines of the text stream, separated by ``'\\n'`` or ``'\\r'``.

def generator(self) -> Iterator[str]:
        """
        Create a generate that iterates the whole content of the file or string.

        :return: An iterator iterating the lines of the text stream, separated by ``'\\n'`` or ``'\\r'``.
        """
        stream = self.stream  # In case that ``self.stream`` is changed.
        stream.seek(0)
        for line in stream:
            yield line