You might not want to write your object directly to a file using the
archiveRootObject:ToFile: method, as was done in the previous program examples. For example, perhaps you want to collect some or all of your objects and store them in a single archive file. You can do this in Objective-C using the data object class called
NSData, as touched on briefly in Chapter 16, “Working with Files.”
As mentioned in Chapter 16, an
NSData object can be used to reserve an area of memory into which you can store data. Typical uses of this data area might be to provide temporary storage for data that will subsequently be written to a file or perhaps to hold the contents of a file read from the disk. The simplest way to ...