Up

NSUnarchiver class reference

Authors

Andrew Kachites McCallum (mccallum@gnu.ai.mit.edu)
Richard Frith-Macdonald (rfm@gnu.org)
Richard Frith-Macdonald (richard@brainstorm.co.uk)
Richard frith-Macdonald (richard@brainstorm.co.Ik)

Version: 1.59

Date: 2003/08/20 12:13:34

Copyright: (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the NSArchiver class
  2. Software documentation for the NSUnarchiver class
  3. Software documentation for the NSArchiver(GNUstep) category
  4. Software documentation for the NSUnarchiver(GNUstep) category

Software documentation for the NSArchiver class

NSArchiver : NSCoder

Declared in:
Foundation/NSArchiver.h
Standards:

Description forthcoming.

Method summary

archiveRootObject:toFile:

+ (BOOL) archiveRootObject: (id)rootObject toFile: (NSString*)path;

Description forthcoming.


archivedDataWithRootObject:

+ (NSData*) archivedDataWithRootObject: (id)rootObject;

Description forthcoming.


archiverData

- (NSMutableData*) archiverData;

Description forthcoming.


classNameEncodedForTrueClassName:

- (NSString*) classNameEncodedForTrueClassName: (NSString*)trueName;

Description forthcoming.


encodeClassName:intoClassName:

- (void) encodeClassName: (NSString*)trueName intoClassName: (NSString*)inArchiveName;

Description forthcoming.


initForWritingWithMutableData:

- (id) initForWritingWithMutableData: (NSMutableData*)mdata;

Description forthcoming.


replaceObject:withObject:

- (void) replaceObject: (id)object withObject: (id)newObject;

Description forthcoming.


Software documentation for the NSUnarchiver class

NSUnarchiver : NSCoder

Declared in:
Foundation/NSArchiver.h
Standards:

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 -

-deserializeTypeTag:andCrossRef:atCursor:
to decode type tags for data items, the tag is the first byte of the character encoding string for the data type (as provided by '@encode(xxx)'), possibly with the top bit set to indicate that what follows is a crossreference to an item already encoded.
Also decode a crossreference number either to identify the following item, or to refer to a previously encoded item. Objects, Classes, Selectors, CStrings and Pointer items have crossreference encoding, other types do not.
[NSData -deserializeDataAt:ofObjCType:atCursor:context:]
to decode all other information.

And 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

classNameDecodedForArchiveClassName:

+ (NSString*) classNameDecodedForArchiveClassName: (NSString*)nameInArchive;

Description forthcoming.


decodeClassName:asClassName:

+ (void) decodeClassName: (NSString*)nameInArchive asClassName: (NSString*)trueName;

Description forthcoming.


unarchiveObjectWithData:

+ (id) unarchiveObjectWithData: (NSData*)anObject;

Description forthcoming.


unarchiveObjectWithFile:

+ (id) unarchiveObjectWithFile: (NSString*)path;

Description forthcoming.


classNameDecodedForArchiveClassName:

- (NSString*) classNameDecodedForArchiveClassName: (NSString*)nameInArchive;

Description forthcoming.


decodeClassName:asClassName:

- (void) decodeClassName: (NSString*)nameInArchive asClassName: (NSString*)trueName;

Description forthcoming.


initForReadingWithData:

- (id) initForReadingWithData: (NSData*)anObject;

Description forthcoming.


isAtEnd

- (BOOL) isAtEnd;

Description forthcoming.


objectZone

- (NSZone*) objectZone;

Description forthcoming.


replaceObject:withObject:

- (void) replaceObject: (id)anObject withObject: (id)replacement;

Description forthcoming.


setObjectZone:

- (void) setObjectZone: (NSZone*)aZone;

Description forthcoming.


systemVersion

- (unsigned int) systemVersion;

Description forthcoming.


Software documentation for the NSArchiver(GNUstep) category

NSArchiver(GNUstep)

Declared in:
Foundation/NSArchiver.h
Standards:

Description forthcoming.

Method summary

directDataAccess

- (BOOL) directDataAccess;

Description forthcoming.


resetArchiver

- (void) resetArchiver;

Description forthcoming.


serializeHeaderAt:version:classes:objects:pointers:

- (void) serializeHeaderAt: (unsigned)positionInData version: (unsigned)systemVersion classes: (unsigned)classCount objects: (unsigned)objectCount pointers: (unsigned)pointerCount;

Description forthcoming.


Software documentation for the NSUnarchiver(GNUstep) category

NSUnarchiver(GNUstep)

Declared in:
Foundation/NSArchiver.h
Standards:

Description forthcoming.

Method summary

cursor

- (unsigned) cursor;

Description forthcoming.


deserializeHeaderAt:version:classes:objects:pointers:

- (void) deserializeHeaderAt: (unsigned*)pos version: (unsigned*)v classes: (unsigned*)c objects: (unsigned*)o pointers: (unsigned*)p;

Description forthcoming.


directDataAccess

- (BOOL) directDataAccess;

Description forthcoming.


resetUnarchiverWithData:atIndex:

- (void) resetUnarchiverWithData: (NSData*)anObject atIndex: (unsigned)pos;

Description forthcoming.



Up