Contents

data(withCapacity:options:)

Declaration

func data(withCapacity capacity: Int, options: IOUSBHostObjectDataOptions = []) throws -> NSMutableData

Parameters

  • capacity:

    Size of the buffer to allocate

  • options:

    IOUSBHostObjectDataOptions. Default value is IOUSBHostObjectDataOptionsNone.

Return Value

NSMutableData of memory mapped to user space of an IOBufferMemoryDescriptor if successful, otherwise nil. An IOReturn error code will be reported on failure. The result is to be released by the caller

Discussion

Allocate a buffer to be used for I/O or an isochronous frame list.

This method will allocate and map an IOBufferMemoryDescriptor optimized for use by the underlying controller hardware. A buffer allocated by this method will not be bounced to perform DMA operations. Because the NSMutableData is backed by kernel memory, the length and capacity are not mutable. Any changes to the length or capacity will cause an exception to be thrown.