---
title: CFReadStream
framework: corefoundation
role: symbol
role_heading: Class
path: corefoundation/cfreadstream
---

# CFReadStream

## Declaration

```swift
class CFReadStream
```

## Overview

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

- [CFReadStreamCreateWithBytesNoCopy(_:_:_:_:)](corefoundation/cfreadstreamcreatewithbytesnocopy(_:_:_:_:).md)
- [CFReadStreamCreateWithFile(_:_:)](corefoundation/cfreadstreamcreatewithfile(_:_:).md)

### Opening and Closing a Read Stream

- [CFReadStreamClose(_:)](corefoundation/cfreadstreamclose(_:).md)
- [CFReadStreamOpen(_:)](corefoundation/cfreadstreamopen(_:).md)

### Reading from a Stream

- [CFReadStreamRead(_:_:_:)](corefoundation/cfreadstreamread(_:_:_:).md)

### Scheduling a Read Stream

- [CFReadStreamScheduleWithRunLoop(_:_:_:)](corefoundation/cfreadstreamschedulewithrunloop(_:_:_:).md)
- [CFReadStreamUnscheduleFromRunLoop(_:_:_:)](corefoundation/cfreadstreamunschedulefromrunloop(_:_:_:).md)

### Examining Stream Properties

- [CFReadStreamCopyProperty(_:_:)](corefoundation/cfreadstreamcopyproperty(_:_:).md)
- [CFReadStreamGetBuffer(_:_:_:)](corefoundation/cfreadstreamgetbuffer(_:_:_:).md)
- [CFReadStreamCopyError(_:)](corefoundation/cfreadstreamcopyerror(_:).md)
- [CFReadStreamGetError(_:)](corefoundation/cfreadstreamgeterror(_:).md)
- [CFReadStreamGetStatus(_:)](corefoundation/cfreadstreamgetstatus(_:).md)
- [CFReadStreamHasBytesAvailable(_:)](corefoundation/cfreadstreamhasbytesavailable(_:).md)

### Setting Stream Properties

- [CFReadStreamSetClient(_:_:_:_:)](corefoundation/cfreadstreamsetclient(_:_:_:_:).md)
- [CFReadStreamSetProperty(_:_:_:)](corefoundation/cfreadstreamsetproperty(_:_:_:).md)

### Getting the CFReadStream Type ID

- [CFReadStreamGetTypeID()](corefoundation/cfreadstreamgettypeid().md)

### Callbacks

- [CFReadStreamClientCallBack](corefoundation/cfreadstreamclientcallback.md)

### Data Types

- [CFStreamClientContext](corefoundation/cfstreamclientcontext.md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)

## See Also

### Opaque Types

- [CFAllocator](corefoundation/cfallocator.md)
- [CFArray](corefoundation/cfarray.md)
- [CFAttributedString](corefoundation/cfattributedstring.md)
- [CFBag](corefoundation/cfbag.md)
- [CFBinaryHeap](corefoundation/cfbinaryheap.md)
- [CFBitVector](corefoundation/cfbitvector.md)
- [CFBoolean](corefoundation/cfboolean.md)
- [CFBundle](corefoundation/cfbundle.md)
- [CFCalendar](corefoundation/cfcalendar.md)
- [CFCharacterSet](corefoundation/cfcharacterset.md)
- [CFData](corefoundation/cfdata.md)
- [CFDate](corefoundation/cfdate.md)
- [CFDateFormatter](corefoundation/cfdateformatter.md)
- [CFDictionary](corefoundation/cfdictionary.md)
- [CFError](corefoundation/cferror.md)
