Initializer

init(bytes​No​Copy:​length:​free​When​Done:​)

Initializes a newly allocated data object by adding to it length bytes of data from the buffer bytes.

Declaration

init(bytesNoCopy bytes: UnsafeMutableRawPointer, length: Int, freeWhenDone b: Bool)

Parameters

bytes

A buffer containing data for the new object. If flag is true, bytes must point to a memory block allocated with malloc.

length

The number of bytes to hold from bytes. This value must not exceed the length of bytes.

flag

If true, the returned object takes ownership of the bytes pointer and frees it on deallocation.

See Also

Related Symbols

data​With​Bytes​No​Copy:​length:​free​When​Done:​

Creates and returns a data object that holds a given number of bytes from a given buffer.

init(bytes​No​Copy:​ Unsafe​Mutable​Raw​Pointer, length:​ Int)

Returns a data object initialized by adding to it a given number of bytes of data from a given buffer.

init(bytes:​ Unsafe​Raw​Pointer?, length:​ Int)

Returns a data object initialized by adding to it a given number of bytes of data copied from a given buffer.