def __add__(self, other): old_pos = self.tell() old_other_pos = other.tell() new = BufferedByteStream(self) other.seek(0) new.seek(0, 2) new.write(other.read()) self.seek(old_pos) other.seek(old_other_pos) new.seek(0) return new
def __init__(self, *args, **kwargs): BufferedByteStream.__init__(self, *args, **kwargs) self._buffer = self