Contents

read(into:startingAt:length:)

Asychronously reads data from the resource into a buffer.

Declaration

func read(into buffer: UnsafeMutableRawBufferPointer, startingAt offset: off_t, length: Int) async throws -> Int

Parameters

  • buffer:

    A buffer to receive the data.

  • offset:

    The offset into the resource from which to start reading.

  • length:

    A maximum number of bytes to read. The completion handler receives a parameter with the actual number of bytes read.

Return Value

The actual number of bytes read.

Discussion

For the read to succeed, requests must conform to any transfer requirements of the underlying resource. Disk drives typically require sector (physicalBlockSize) addressed operations of one or more sector-aligned offsets.

See Also

Reading and writing data