Contents

CFReadStream

Declaration

class CFReadStream

Overview

CFReadStream provides an interface for reading a byte stream either synchronously or asynchronously. You can create streams that read bytes from a block of memory, a file, or a generic socket. All streams need to be opened, using CFReadStreamOpen(_:), before reading.

Use CFWriteStream for writing byte streams. The CFNetwork framework defines an additional type of stream for reading responses to HTTP requests.

CFReadStream is “toll-free bridged” with its Cocoa Foundation counterpart, InputStream. This means that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. Therefore, in a method where you see an NSInputStream * parameter, you can pass in a CFReadStreamRef, and in a function where you see a CFReadStreamRef parameter, you can pass in an NSInputStream instance. Note, however, that you may have either a delegate or callbacks but not both. See Toll-Free Bridged Types for more information on toll-free bridging.

Topics

Creating a Read Stream

Opening and Closing a Read Stream

Reading from a Stream

Scheduling a Read Stream

Examining Stream Properties

Setting Stream Properties

Getting the CFReadStream Type ID

Callbacks

Data Types

See Also

Opaque Types