Instance Method

getBytes(_:length:)

Copies a number of bytes from the start of the data object into a given buffer.

Declaration

func getBytes(_ buffer: UnsafeMutableRawPointer, length: Int)

Parameters

buffer

A buffer into which to copy data.

length

The number of bytes from the start of the receiver's data to copy to buffer.

Discussion

The number of bytes copied is the smaller of the length parameter and the length of the data encapsulated in the object.

See Also

Accessing Underlying Bytes

var bytes: UnsafeRawPointer

A pointer to the data object's contents.

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

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

func getBytes(UnsafeMutableRawPointer)

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

Deprecated
func getBytes(UnsafeMutableRawPointer, range: NSRange)

Copies a range of bytes from the data object into a given buffer.