(self, n: int)
| 100 | self.data = data |
| 101 | |
| 102 | def _read(self, n: int): |
| 103 | if len(self.data) < n: |
| 104 | raise EOFError(f'have {len(self.data)} bytes left, but {n} requested') |
| 105 | elif n == 0: |
| 106 | return b'' |
| 107 | chunk = self.data[:n] |
| 108 | del self.data[:n] |
| 109 | return chunk |
| 110 | |
| 111 | def next_frame(self): |
| 112 | data = self._read(2) |