Class: NSKeyedUnarchiver
Overview
NSKeyedUnarchiver, a concrete subclass of NSCoder, defines methods for decoding a set of named objects (and scalar values) from a keyed archive. Such archives are produced by instances of the NSKeyedArchiver class.
Class Method Summary (collapse)
-
+ classForClassName:
Returns the class from which NSKeyedUnarchiver instantiates an encoded object with a given class name.
-
+ setClass:forClassName:
Adds a class translation mapping to NSKeyedUnarchiver whereby objects encoded with a given class name are decoded as instances of a given class instead.
-
+ unarchiveObjectWithData:
Decodes and returns the object graph previously encoded by NSKeyedArchiver and stored in a given NSData object.
-
+ unarchiveObjectWithFile:
Decodes and returns the object graph previously encoded by NSKeyedArchiver written to the file at a given path.
Instance Method Summary (collapse)
-
- classForClassName:
Returns the class from which the receiver instantiates an encoded object with a given class name.
-
- containsValueForKey:
Returns a Boolean value that indicates whether the archive contains a value for a given key within the current decoding scope.
-
- decodeBoolForKey:
Decodes a Boolean value associated with a given key.
-
- decodeBytesForKey:returnedLength:
Decodes a stream of bytes associated with a given key.
-
- decodeDoubleForKey:
Decodes a double-precision floating-point value associated with a given key.
-
- decodeFloatForKey:
Decodes a single-precision floating-point value associated with a given key.
-
- decodeInt32ForKey:
Decodes a 32-bit integer value associated with a given key.
-
- decodeInt64ForKey:
Decodes a 64-bit integer value associated with a given key.
-
- decodeIntForKey:
Decodes an integer value associated with a given key.
-
- decodeObjectForKey:
Decodes and returns an object associated with a given key.
-
- delegate
Returns the receiver’s delegate.
-
- finishDecoding
Tells the receiver that you are finished decoding objects.
-
- initForReadingWithData:
Initializes the receiver for decoding an archive previously encoded by NSKeyedArchiver.
-
- setClass:forClassName:
Adds a class translation mapping to the receiver whereby objects encoded with a given class name are decoded as instances of a given class instead.
-
- setDelegate:
Sets the receiver’s delegate.
Methods inherited from NSCoder
#allowedClasses, #allowsKeyedCoding, #decodeArrayOfObjCType:count:at:, #decodeBytesWithReturnedLength:, #decodeDataObject, #decodeIntegerForKey:, #decodeObject, #decodeObjectOfClass:forKey:, #decodeObjectOfClasses:forKey:, #decodePropertyListForKey:, #decodeValueOfObjCType:at:, #decodeValuesOfObjCTypes:, #encodeArrayOfObjCType:count:at:, #encodeBool:forKey:, #encodeBycopyObject:, #encodeByrefObject:, #encodeBytes:length:, #encodeBytes:length:forKey:, #encodeConditionalObject:, #encodeConditionalObject:forKey:, #encodeDataObject:, #encodeDouble:forKey:, #encodeFloat:forKey:, #encodeInt32:forKey:, #encodeInt64:forKey:, #encodeInt:forKey:, #encodeInteger:forKey:, #encodeObject:, #encodeObject:forKey:, #encodeRootObject:, #encodeValueOfObjCType:at:, #encodeValuesOfObjCTypes:, #objectZone, #requiresSecureCoding, #setObjectZone:, #systemVersion, #versionForClassName:
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
+ (Class) classForClassName(codedName)
Returns the class from which NSKeyedUnarchiver instantiates an encoded object with a given class name.
+ (Object) setClass(cls, forClassName:codedName)
Adds a class translation mapping to NSKeyedUnarchiver whereby objects encoded with a given class name are decoded as instances of a given class instead. When decoding, the class’s translation mapping is used only if no translation is found first in an instance’s separate translation map.
+ (Object) unarchiveObjectWithData(data)
Decodes and returns the object graph previously encoded by NSKeyedArchiver and stored in a given NSData object. This method raises an NSInvalidArchiveOperationException if data is not a valid archive.
+ (Object) unarchiveObjectWithFile(path)
Decodes and returns the object graph previously encoded by NSKeyedArchiver written to the file at a given path. This method raises an NSInvalidArgumentException if the file at path does not contain a valid archive.
Instance Method Details
- (Class) classForClassName(codedName)
Returns the class from which the receiver instantiates an encoded object with a given class name. The class’s separate translation map is not searched.
- (Boolean) containsValueForKey(key)
Returns a Boolean value that indicates whether the archive contains a value for a given key within the current decoding scope.
- (Boolean) decodeBoolForKey(key)
Decodes a Boolean value associated with a given key.
- (Integer) decodeBytesForKey(key, returnedLength:lengthp)
Decodes a stream of bytes associated with a given key. The returned value is a pointer to a temporary buffer owned by the receiver. The buffer goes away with the unarchiver, not the containing autoreleasepool block. You must copy the bytes into your own buffer if you need the data to persist beyond the life of the receiver.
- (Float) decodeDoubleForKey(key)
Decodes a double-precision floating-point value associated with a given key. If the archived value was encoded as single-precision, the type is coerced.
- (Float) decodeFloatForKey(key)
Decodes a single-precision floating-point value associated with a given key. If the archived value was encoded as double precision, the type is coerced, loosing precision. If the archived value is too large for single precision, the method raises an NSRangeException.
- (Integer) decodeInt32ForKey(key)
Decodes a 32-bit integer value associated with a given key. If the archived value was encoded with a different size but is still an integer, the type is coerced. If the archived value is too large to fit into a 32-bit integer, the method raises an NSRangeException.
- (Integer) decodeInt64ForKey(key)
Decodes a 64-bit integer value associated with a given key. If the archived value was encoded with a different size but is still an integer, the type is coerced.
- (Integer) decodeIntForKey(key)
Decodes an integer value associated with a given key. If the archived value was encoded with a different size but is still an integer, the type is coerced. If the archived value is too large to fit into the default size for an integer, the method raises an NSRangeException.
- (Object) decodeObjectForKey(key)
Decodes and returns an object associated with a given key.
- (Object) delegate
Returns the receiver’s delegate.
- (Object) finishDecoding
Tells the receiver that you are finished decoding objects. Invoking this method allows the receiver to notify its delegate and to perform any final operations on the archive. Once this method is invoked, the receiver cannot decode any further values.
- (Object) initForReadingWithData(data)
Initializes the receiver for decoding an archive previously encoded by NSKeyedArchiver. When you finish decoding data, you should invoke finishDecoding.This method raises an NSInvalidArchiveOperationException if data is not a valid archive.
- (Object) setClass(cls, forClassName:codedName)
Adds a class translation mapping to the receiver whereby objects encoded with a given class name are decoded as instances of a given class instead. When decoding, the receiver’s translation map overrides any translation that may also be present in the class’s map (see setClass:forClassName:).
- (Object) setDelegate(delegate)
Sets the receiver’s delegate.