---
title: "CFWriteStreamCreateWithAllocatedBuffers(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfwritestreamcreatewithallocatedbuffers(_:_:)"
---

# CFWriteStreamCreateWithAllocatedBuffers(_:_:)

Creates a writable stream for a growable block of memory.

## Declaration

```swift
func CFWriteStreamCreateWithAllocatedBuffers(_ alloc: CFAllocator!, _ bufferAllocator: CFAllocator!) -> CFWriteStream!
```

## 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

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

## Discussion

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(_:_:_:)](corefoundation/cfwritestreamcreatewithbuffer(_:_:_:).md)
- [CFWriteStreamCreateWithFile(_:_:)](corefoundation/cfwritestreamcreatewithfile(_:_:).md)
