code: def read(self, size=-1):
      
      self._check_open()
      if not self._remaining():
        return ''
  
      data_list = []
      while True:
        remaining = self._buffer.remaining()
        if size >= 0 and size < remaining:
          data_list.append(self._buffer.read(size))
          self._offset += size
          break
        else:
          size -= remaining
          self._offset += remaining
          data_list.append(self._buffer.read())
  
          if self._buffer_future is None:
            if size < 0 or size >= self._remaining():
              needs = self._remaining()
            else:
              needs = size
            data_list.extend(self._get_segments(self._offset, needs))
            self._offset += needs
            break
  
          if self._buffer_future:
            self._buffer.reset(self._buffer_future.get_result())
            self._buffer_future = None
  
      if self._buffer_future is None:
        self._request_next_buffer()
      return ''.join(data_list)
docs: Read data from RAW file.
  
      Args:
        size: Number of bytes to read as integer. Actual number of bytes
          read is always equal to size unless EOF is reached. If size is
          negative or unspecified, read the entire file.
  
      Returns:
        data read as str.
  
      Raises:
        IOError: When this buffer is closed.