NSFileHandle
When reading a file, Cocoa programmers often read in an entire file and pack it into an NSData or NSString before parsing it. When writing a file, Cocoa programmers usually create a complete NSData or NSString which is then written to the file system. Sometimes you want more control over reading from and writing to files. For example, you might read a file just until you find what you want and then close it. For more control over reading and writing from files, you use an NSFileHandle object.
An NSFileHandle is used for reading and writing files. Some of the reading methods are blocking (that is, the application stops and waits for the data to become available), and others are non-blocking. We’ll discuss the non-blocking methods ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access