CFWriteStreamCreateWithBuffer(_:_:_:)
Creates a writable stream for a fixed-size block of memory.
Declaration
func CFWriteStreamCreateWithBuffer(_ alloc: CFAllocator!, _ buffer: UnsafeMutablePointer<UInt8>!, _ bufferCapacity: CFIndex) -> CFWriteStream!Parameters
- alloc:
The allocator to use to allocate memory for the new object. Pass
NULLor kCFAllocatorDefault to use the current default allocator. - buffer:
The memory buffer into which to write data. This buffer must exist for the lifetime of the stream.
- bufferCapacity:
The size of
bufferand the maximum number of bytes that can be written.
Return Value
A new write stream, or NULL on failure. Ownership follows the The Create Rule.
Discussion
When buffer is filled after writing bufferCapacity bytes, the stream is exhausted and its status becomes CFStreamStatus.atEnd.
You must open the stream, using CFWriteStreamOpen(_:), before writing to it.