mccallum@gnu.ai.mit.edu
)rfm@gnu.org
)richard@brainstorm.co.Ik
)richard@brainstorm.co.uk
)Version: 1.60
Date: 2004/09/27 21:32:45
Copyright: (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSArchiver.h
Standards:
- MacOS-X
- OpenStep
- GNUstep
Implementation of NSCoder capable of creating sequential archives which must be read in the same order they were written. This class implements methods for saving to and restoring from a serial archive (usually a file on disk, but can be an NSData object) as well as methods that can be used by objects that need to write/restore themselves.
Note, the sibling class NSKeyedArchiver supports a form of archive that is more robust to class changes, and is recommended over this one.
Method summary
Writes out serialized representation of object and, recursively, any other objects it holds references to.
Writes serialized representation of object and, recursively, any other objects it holds references to, to byte array.
Returns whatever data has been encoded thusfar.
Returns substitute class used to encode objects of given class. This would have been set through an earlier call to [NSArchiver -encodeClassName:intoClassName:].
Specify substitute class used in archiving objects
of given class. This class is written to the archive as
the class to use for restoring the object, instead of
what is returned from [NSObject -classForArchiver].
This can be used to provide backward compatibility
across class name changes. The object is still
encoded by calling encodeWithCoder:
as
normal.
Init instance that will archive its data to mdata. (Even if [archiveRootObject:toFile:] is called, this still gets written to.)
Set encoder to write out newObject in place of object.
- Declared in:
- Foundation/NSArchiver.h
Standards:
- MacOS-X
- OpenStep
- GNUstep
This class reconstructs objects from an archive.
Re-using the archiver
The -resetUnarchiverWithData:atIndex: method lets you re-use the archive to decode a new data object or, in conjunction with the 'cursor' method (which reports the current decoding position in the archive), decode a second archive that exists in the data object after the first one.
Subclassing with different input format.
NSUnarchiver
normally reads
directly from an
NSData
object using the methods -
NSUnarchiver
normally uses other
NSData
methods to read the archive header information
from within the method:
[-deserializeHeaderAt:version:classes:objects:pointers:]
to read a fixed size header including archiver version (obtained by [self systemVersion]
) and crossreference table sizes.
To subclass NSUnarchiver
, you must
implement your own versions of the four
methods above, and override the
'directDataAccess' method to return
NO
so that the archiver knows to
use your serialization methods rather than those in
the
NSData
object.
Method summary
Returns class name unarchivers will use to instantiate encoded objects when they report their class name as nameInArchive.
Sets class name unarchivers will use to instantiate encoded objects when they report their class name as nameInArchive. This can be used to support backwards compatibility across class name changes.
Creates an NSUnarchiver to read from anObject and returns result of sending [NSCoder -decodeObject] to it.
Creates an NSUnarchiver to read from path and returns result of sending [NSCoder -decodeObject] to it.
Returns class name this unarchiver uses to instantiate encoded objects when they report their class name as nameInArchive.
Set class name this unarchiver uses to instantiate encoded objects when they report their class name as nameInArchive. This can be used to provide backward compatibility across class name changes.
Set up to read objects from data buffer anObject.
Returns whether have currently read through all of data buffer or file this unarchiver was initialized with.
Returns zone unarchived objects will be allocated from.
Set unarchiver to replace anObject with replacement whenever it is found decoded from the archive.
Sets zone unarchived objects will be allocated from.
Returns system version archive was encoded by.
- Declared in:
- Foundation/NSArchiver.h
Standards:
- NotOpenStep
- NotMacOS-X
- GNUstep
Catagory for compatibility with old GNUstep encoding.
Method summary
Returns YES
.
Allow reuse of archiver (clears class substitution maps, etc.) but do not clear out current serialized data.
Writes out header for GNUstep archive format.
- Declared in:
- Foundation/NSArchiver.h
Standards:
- NotOpenStep
- NotMacOS-X
- GNUstep
Catagory for compatibility with old GNUstep encoding.
Method summaryReturn current position within archive byte array.
Reads in header for GNUstep archive format.
Returns YES
.
Prepare for reuse of the unarchiver to unpack a new archive, specified in anObject, starting at pos. Reads archive header.