Asynchronously reads a number of bytes from the stream, and calls a handler upon completion.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The minimum number of bytes to read.
The maximum number of bytes to read.
A timeout for reading bytes. If the read is not completed within the specified interval, the read is canceled and the
completionis called with an error. Pass
0to prevent a read from timing out.
The completion handler to call when all bytes are read, or an error occurs. This handler is executed on the delegate queue.
This completion handler takes the following parameters:
The data read from the stream.
Whether or not the stream reached end-of-file (EOF), such that no more data can be read.
An error object that indicates why the read failed, or
nilif the read was successful.