Instance Method

getBytes(_:)

Copies a data object’s contents into a given buffer.

Declaration

func getBytes(_ buffer: UnsafeMutableRawPointer)

Parameters

buffer

A buffer into which to copy the receiver's data. The buffer must be at least length bytes.

Discussion

You can see a sample using this method in Working With Binary Data.

See Also

Accessing Underlying Bytes

var bytes: UnsafeRawPointer

A pointer to the receiver’s contents.

func enumerateBytes((UnsafeRawPointer, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void)

Enumerates each range of bytes in the data object using a block.

func getBytes(UnsafeMutableRawPointer, length: Int)

Copies a number of bytes from the start of the receiver's data into a given buffer.

func getBytes(UnsafeMutableRawPointer, range: NSRange)

Copies a range of bytes from the receiver’s data into a given buffer.