Function

CFWriteStreamCreateWithAllocatedBuffers

Creates a writable stream for a growable block of memory.

Declaration

CFWriteStreamRef CFWriteStreamCreateWithAllocatedBuffers(CFAllocatorRef alloc, CFAllocatorRef bufferAllocator);

Parameters

alloc

The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

bufferAllocator

The allocator to use to allocate memory for the stream’s memory buffers. Pass NULL or kCFAllocatorDefault to use the current default allocator.

Return Value

A new write stream. Ownership follows the The Create Rule.

Discussion

New buffers are allocated using bufferAllocator as bytes are written to the stream. At any point, you can recover the bytes thus far written by asking for the property kCFStreamPropertyDataWritten with CFWriteStreamCopyProperty.

You must open the stream, using CFWriteStreamOpen, before writing to it.

See Also

Creating a Write Stream

CFWriteStreamCreateWithBuffer

Creates a writable stream for a fixed-size block of memory.

CFWriteStreamCreateWithFile

Creates a writable stream for a file.