Read data from the ring buffer into a new buffer.

        This advances the read index after reading;
        calling :meth:`advance_read_index` is *not* necessary.

        :param size: The number of elements to be read.
            If not specified, all available elements are read.
        :type size: int, optional

        :returns: A new buffer containing the read data.
            Its size may be less than the requested *size*.
        :rtype: buffer

def read(self, size=-1):
        """Read data from the ring buffer into a new buffer.

        This advances the read index after reading;
        calling :meth:`advance_read_index` is *not* necessary.

        :param size: The number of elements to be read.
            If not specified, all available elements are read.
        :type size: int, optional

        :returns: A new buffer containing the read data.
            Its size may be less than the requested *size*.
        :rtype: buffer

        """
        if size < 0:
            size = self.read_available
        data = self._ffi.new('unsigned char[]', size * self.elementsize)
        size = self.readinto(data)
        return self._ffi.buffer(data, size * self.elementsize)