Return size bytes from stream. If internal buffer is empty, read another block from the stream.
(self, size)
| 565 | return t[:size] |
| 566 | |
| 567 | def __read(self, size): |
| 568 | """Return size bytes from stream. If internal buffer is empty, |
| 569 | read another block from the stream. |
| 570 | """ |
| 571 | c = len(self.buf) |
| 572 | t = [self.buf] |
| 573 | while c < size: |
| 574 | buf = self.fileobj.read(self.bufsize) |
| 575 | if not buf: |
| 576 | break |
| 577 | t.append(buf) |
| 578 | c += len(buf) |
| 579 | t = b"".join(t) |
| 580 | self.buf = t[size:] |
| 581 | return t[:size] |
| 582 | # class _Stream |
| 583 | |
| 584 | class _StreamProxy(object): |