ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/FoundationKit/Classes/NSArchiver.rtf

This is NSArchiver.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc.  All Rights Reserved.

s6 li100 fi0 ri1007 ql f0 b fs36 fs100 
fs36 NSArchiver 
pard s15 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSCoder : NSObject
fs20 
fs28 s8 f0 b fs24 Conforms To:tab b0 fs28 f1 NSObject (NSObject)
fs20 
fs28 s9 f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSArchiver.h 
fs20 
fs28 pard s20 li100 fi0 ri1007 ql f0 b fs28 fs20 
fs28 Class Description
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 
fs28 NSArchiver, a concrete subclass of NSCoder, defines an object that encodes Objective C objects into an architecture-independent format that can be stored in a file. When objects are archived, their class information and the values of their instance variables are written to the archive. NSArchiver'27s companion class, NSUnarchiver, takes an archive file and decodes its contents into a set of objects equivalent to the original one.
fs16 
fs28 Archiving is typically initiated by sending an NSArchiver an b encodeRootObject:b0  or b archiveRootObject:toFile:b0  message. These messages specify a single object that is the starting point for archiving. The root object receives an b encodeWithCoder:b0  message (see the NSCoding protocol) that allows it to begin archiving itself and the other objects that it'27s connected to. An object responds to an b encodeWithCoder:b0  message by writing its instance variables to the archiver.
fs16 
fs28 An object doesn'27t have to archive the values of each of its instance variables. Some values may not be important to reestablish and others may be derivable from related state upon unarchiving. Other instance variables should be written to the archive only under certain conditions, as explained below.
fs16 
fs28 NSArchiver overrides the inherited b encodeRootObject:b0  and b encodeConditionalObject:b0  methods to support the conditional archiving of members of a graph of objects. When an object receives an b encodeWithCoder:b0  message, it should respond by unconditionally archiving instance variables that are intrinsic to its nature (with the exceptions noted above) and conditionally archiving those that are not.   For example, an NSView unconditionally archives its array of subviews (using b encodeObject:b0 , or the like) but conditionally archives its superview (using b encodeConditionalObject:b0 ). The archiving system notes each reference to a conditional object, but doesn'27t actually archive the object unless some other object in the graph requests the object to be archived unconditionally. This ensures that an object is only archived once despite multiple references to it in the object graph. When the objects are extracted from the archive, the multiple references to objects are resolved, and an equivalent graph of objects is reestablished.
fs16 
fs28 pard s20 li100 fi0 ri1007 ql f0 b fs24 
fs28 Initializing an NSArchiver
fs14 
fs28 pard s10 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (id)b initForWritingWithMutableData:b0 (NSMutableData *)i mdatai0 tab 
s11 li7030 fi-6553 fi-5796 tab Initializes an archiver, encoding stream and version information into mutable data i mdatai0 . Raises NSInvalidArgumentException if the i mdatai0  argument is b nilb0 .
pard s20 li100 fi0 ri1007 ql f0 b fs48 
fs28 Archiving Data 
fs14 
fs28 pard s10 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (NSData *)b archivedDataWithRootObject:b0 (id)i rootObjecti0 tab 
s11 li7030 fi-6553 fi-5796 tab Creates and returns a data object after initializing an archiver with that object and encoding the archiver with i rootObjecti0 .
s10 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 + (BOOL)b archiveRootObject:b0 (id)i rootObjecti0 tab Archivesi  rootObjecti0  by encoding it as a data object in
s11 li7030 fi-6553 fi-5796 b toFile:b0 (NSString *)i pathi0 tab tab an archiver and writing that data object to file i pathi0 . Returns YES upon success.
s10 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b encodeArrayOfObjCType:b0 (const char *)i typei0 tab  Encodes an i arrayi0  of i counti0  data elements of the same 
s11 li7030 fi-6553 fi-5796 b count:b0 (unsigned int)i counti0 tab tab Objective C data i typei0 .i  
i0 b at:b0 (const void *)i array
s10 li7029 fi-5794 fi-6552 i0 fs16 
fs28 fi-6552 {f3 -} (void)b encodeConditionalObject:b0 (id)i objecti0 tab Encodes into the linearized data a conditional i objecti0  that points back toward a root object. If b nilb0  is specified for i objecti0 , it encodes it as b nilb0  unconditionally. Raises an NSInvalidArgumentException if no root object has been encoded.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b encodeRootObject:b0 (id)i rootObjecti0 tab Encodes the i rootObjecti0  at the start of the linearized data representing the object graph. Raises an NSInvalidArgumentException if the root object has already been encoded.
pard s20 li100 fi0 ri1007 ql f0 b fs48 
fs28 Getting Data from the NSArchiver
fs14 
fs28 pard s10 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSMutableData *)b archiverDatab0 tab Returns the data object, in mutable form, that is associated with the receiving NSArchiver.
pard s20 li100 fi0 ri1007 ql f0 b fs48 
fs28 Substituting One Class for Another 
fs14 
fs28 pard s10 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSString *)b classNameEncodedForTrueClassName:b0 (NSString *)i trueName
s11 li7030 fi-6553 fi-5796 i0 tab Returns the class name used to archive instances of the class i trueNamei0 . See b encodeClassName:intoClassNameb0 .
s10 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b encodeClassName:b0 (NSString *)i trueNamei0 tab Encodes in the archive a substitute class name 
s11 li7030 fi-6553 fi-5796 b intoClassName:b0 (NSString *)i inArchiveNamei0 )tab tab for the real class name (i trueNamei0 ). 
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.