Contents

getBytes(_:fromOffset:length:error:)

Copies a specified range of bytes into a given buffer.

Declaration

func getBytes(_ buffer: UnsafeMutablePointer<UInt8>!, fromOffset offset: Int64, length: Int, error: NSErrorPointer) -> Int

Parameters

  • buffer:

    A buffer into which to copy the data.

    You typically use Size() to allocate a buffer of the right size.

  • offset:

    The number of bytes from the beginning of the file to start copying.

  • length:

    The number of bytes to copy.

  • error:

    If an error occurs, upon return contains an NSError object that describes the problem.

    Pass NULL if you do not want error information.

Return Value

The number of bytes actually written to buffer. The number of bytes read will be less than the requested range if the range exceeds the file’s size. If an error occurs, returns 0.

Discussion

This method returns the biggest, best representation available.

See Also

Getting Raw Data