Chapter 10: Working with Files, URLs, and Web Data
In This Chapter
Creating and using file paths
Creating and using URLs
Using Web APIs
Cocoa's file handling is unusual. In most operating systems, files are managed by calling a file manager object. In Cocoa, data objects can read and write data directly. A separate file manager is only required when you need to delete, copy, rename, or move files under program control.
Cocoa's NSFileManager class can be used to access stdio — the default system i/o channel. It also supports nonlinear file reads, making it possible to extract bytes from a while without loading it into memory.
For example, NSString has methods for reading and writing string data to files; NSDictionary can read and write dictionaries; and so on. Typically an initWithContentsOfFile: method initializes a data object with the contents of a file specified by a path string that points to a unique location in the file system. A corresponding writeToFile: method writes data.
For completely general file access, the NSCoder class described in the Chapter ...