Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

NSKeyedArchiverMBS class

Super class: NSCoderMBS

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Cocoa MBS MacBase Plugin 13.2 Yes No No Yes, macOS only No
Function: The plugin class for archiving objects.
Example:
// make archiver
dim a as new NSKeyedArchiverMBS

// add a string
a.encodeString "Hello World", "Greeting"

// finish
a.finishEncoding

// query data
dim m as MemoryBlock = a.archiverData

// start unarchiver
dim u as new NSKeyedUnarchiverMBS(m)

// query and display a value
dim s as string = u.decodeString("Greeting")
MsgBox s
Notes:
NSKeyedArchiver, a concrete subclass of NSCoder, provides a way to encode objects (and scalar values) into an architecture-independent format that can be stored in a file. When you archive a set of objects, the class information and instance variables for each object are written to the archive. NSKeyedArchiver's companion class, NSKeyedUnarchiver, decodes the data in an archive and creates a set of objects equivalent to the original set.

A keyed archive differs from a non-keyed archive in that all the objects and values encoded into the archive are given names, or keys. When decoding a non-keyed archive, values have to be decoded in the same order in which they were encoded. When decoding a keyed archive, because values are requested by name, values can be decoded out of sequence or not at all. Keyed archives, therefore, provide better support for forward and backward compatibility.

The keys given to encoded values must be unique only within the scope of the current object being encoded. A keyed archive is hierarchical, so the keys used by object A to encode its instance variables do not conflict with the keys used by object B, even if A and B are instances of the same class. Within a single object, however, the keys used by a subclass can conflict with keys used in its superclasses.
Subclass of the NSCoderMBS class.

Feedback, Comments & Corrections

Super class NSCoderMBS

This class has no sub classes.


The items on this page are in the following plugins: MBS MacBase Plugin.


NSInputStreamMBS   -   NSKeyedUnarchiverMBS




Links
MBS Xojo Plugins