User:NSCoder

= NSCoder Class Reference =




 * Inherits from || NSObject
 * Conforms to || NSObject (NSObject)
 * Framework || /System/Library/Frameworks/Foundation.framework
 * Availability || Available in Mac OS X v10.0 and later.
 * Declared in || NSCoder.h NSGeometry.h
 * }
 * Availability || Available in Mac OS X v10.0 and later.
 * Declared in || NSCoder.h NSGeometry.h
 * }
 * Declared in || NSCoder.h NSGeometry.h
 * }

'''

Overview
'''

The NSCoder abstract class declares the interface used by concrete subclasses to transfer objects and other Objective-C data items between memory and some other format. This capability provides the basis for archiving (where objects and data items are stored on disk) and distribution (where objects and data items are copied between different processes or threads). The concrete subclasses provided by Foundation for these purposes are NSArchiver, NSUnarchiver , NSKeyedArchiver , NSKeyedUnarchiver , and NSPortCoder. Concrete subclasses of NSCoder are referred to in general as coder classes, and instances of these classes as coder objects (or simply coders). A coder object that can only encode values is referred to as an encoder object, and one that can only decode values as a decoder object.

NSCoder operates on objects, scalars, C arrays, structures, and strings, and on pointers to these types. It does not handle types whose implementation varies across platforms, such as union, void *, function pointers, and long chains of pointers. A coder object stores object type information along with the data, so an object decoded from a stream of bytes is normally of the same class as the object that was originally encoded into the stream. An object can change its class when encoded, however; this is described in Archives and Serializations Programming Guide.

Subclassing Notes
For details of how to create a subclass of NSCoder, see “Subclassing NSCoder” in Archives and Serializations Programming Guide.

Testing Coder
– allowsKeyedCoding

– containsValueForKey:

Encoding Data
– encodeArrayOfObjCType:count:at:

– encodeBool:forKey:

– encodeBycopyObject:

– encodeByrefObject:

– encodeBytes:length:

– encodeBytes:length:forKey:

– encodeConditionalObject:

– encodeConditionalObject:forKey:

– encodeDataObject:

– encodeDouble:forKey:

– encodeFloat:forKey:

– encodeInt:forKey:

– encodeInteger:forKey:

– encodeInt32:forKey:

– encodeInt64:forKey:

– encodeObject:

– encodeObject:forKey:

– encodePoint:

– encodePoint:forKey:

– encodePropertyList:

– encodeRect:

– encodeRect:forKey:

– encodeRootObject:

– encodeSize:

– encodeSize:forKey:

– encodeValueOfObjCType:at:

– encodeValuesOfObjCTypes:

– encodeNXObject: Deprecated in Mac OS X v10.5

Decoding Data
– decodeArrayOfObjCType:count:at:

– decodeBoolForKey:

– decodeBytesForKey:returnedLength:

– decodeBytesWithReturnedLength:

– decodeDataObject

– decodeDoubleForKey:

– decodeFloatForKey:

– decodeIntForKey:

– decodeIntegerForKey:

– decodeInt32ForKey:

– decodeInt64ForKey:

– decodeObject

– decodeObjectForKey:

– decodePoint

– decodePointForKey:

– decodePropertyList

– decodeRect

– decodeRectForKey:

– decodeSize

– decodeSizeForKey:

– decodeValueOfObjCType:at:

– decodeValuesOfObjCTypes:

– decodeNXObject Deprecated in Mac OS X v10.5

Managing Zones
– objectZone

– setObjectZone:

Getting Version Information
– systemVersion

– versionForClassName: