Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSUnarchiver

Inherits From:	NSCoder : NSObject

Conforms To:	NSObject (NSObject)

Declared In:	Foundation/NSArchiver.h 

Class Description

NSUnarchiver, a concrete subclass of NSCoder, defines objects that can decode a data structure, such as a graph of Objective C objects, from an archive. Such archives are produced by objects of the NSArchiver class. See the NSArchiver specification for an introduction to archiving. 

General Exception Conditions

While unarchiving, NSUnarchiver performs a variety of consistency checks on the incoming data stream. NSUnarchiver raises an NSInconsistentArchiveException for a variety of reasons. Possible data errors leading to this exception are: unknown type descriptors in the data file; an array type descriptor is incorrectly terminated (missing ]); excess characters in a type descriptor; a null class found where a concrete class was expected; class not loaded. 

Initializing an NSUnarchiver

- (id)initForReadingWithData:(NSData *)data	Initializes an NSUnarchiver object from data object data. Raises NSInvalidArgumentException if the data argument is nil.

Decoding Objects

+ (id)unarchiveObjectWithData:(NSData *)data	Decodes an archived object stored in data.

+ (id)unarchiveObjectWithFile:(NSString *)path	Decodes an archived object stored in the file path.

- (void)decodeArrayOfObjCType:(const char *)itemType	  
count:(unsigned int)count	Decodes an array of count data elements of the same
at:(void *)array		Objective C data itemType. It is your responsibility to release any objects derived in this way.

Managing an NSUnarchiver

- (BOOL)isAtEnd	Returns YES if the end of data is reached, NO if more data follows.

- (NSZone *)objectZone	Returns the allocation zone for the unarchiver object.

- (void)setObjectZone:(NSZone *)zone	Sets the allocation zone for the unarchiver object to zone. If zone is nil, it sets it to the default zone.

- (unsigned int)systemVersion	Returns the system version number for the unarchived data.

Substituting One Class for Another

+ (NSString *)classNameDecodedForArchiveClassName:(NSString *)nameInArchive
	Returns the class name used to archive instances of the class (nameInArchive). This may not be the original class name but another name encoded with NSArchiver's encodeClassName:intoClassName.

+ (void)decodeClassName:(NSString *)nameInArchive	
asClassName:(NSString *)trueName	Decodes from the archived data a class name (nameInArchive) substituted for the real class name (trueName). This method enables easy conversion of unarchived data when there are name changes in classes.

- (NSString *)classNameDecodedForArchiveClassName:(NSString *)nameInArchive
	Returns the class name used to archive instances of the class (nameInArchive). This may not be the original class name but another name encoded with NSArchiver's encodeClassName:intoClassName.

- (void)decodeClassName:(NSString *)nameInArchive	
asClassName:(NSString *)trueName	Decodes from the archived data a class name (nameInArchive) substituted for the real class name (trueName). This method enables easy conversion of unarchived data when there are name changes in classes.