Read until EOF, using multiple read() call.
(self)
| 652 | return bytes(b) |
| 653 | |
| 654 | def readall(self): |
| 655 | """Read until EOF, using multiple read() call.""" |
| 656 | res = bytearray() |
| 657 | while True: |
| 658 | data = self.read(DEFAULT_BUFFER_SIZE) |
| 659 | if not data: |
| 660 | break |
| 661 | res += data |
| 662 | if res: |
| 663 | return bytes(res) |
| 664 | else: |
| 665 | # b'' or None |
| 666 | return data |
| 667 | |
| 668 | def readinto(self, b): |
| 669 | """Read bytes into a pre-allocated bytes-like object b. |