def read(self, n):
        """Read n bytes.
        Returns exactly n bytes of data unless the underlying raw IO
        stream reaches EOF.
        """
        pos = self._read_pos
        self._read_pos = min(len(self.raw), pos + n)
        return self.raw[pos:self._read_pos]