Initializer

init(toBuffer:capacity:)

Returns an initialized output stream that can write to a provided buffer.

Declaration

init(toBuffer buffer: UnsafeMutablePointer<UInt8>, capacity: Int)

Parameters

buffer

The buffer the output stream will write to.

capacity

The size of the buffer in bytes.

Return Value

An initialized output stream that can write to buffer.

Discussion

The stream must be opened before it can be used.

When the number of bytes written to buffer has reached capacity, the stream’s streamStatus will return NSStreamStatusAtEnd.

See Also

Creating Streams

class func toMemory() -> Self

Creates and returns an initialized output stream that will write stream data to memory.

init(toMemory: ())

Returns an initialized output stream that will write to memory.

init?(toFileAtPath: String, append: Bool)

Returns an initialized output stream for writing to a specified file.

init?(url: URL, append: Bool)

Returns an initialized output stream for writing to a specified URL.