Protocol for object serialization and deserialization in mulle-objc.
-encodeWithCoder:
- Encode object state to coder-initWithCoder:
- Initialize object from encoded data
-classForCoder
- Returns class used for coding (usually provided by NSObject)-decodeWithCoder:
- Used by class clusters to decode after instance substitution
-encodeValueOfObjCType:at:
- Encode value of given type-decodeValueOfObjCType:at:
- Decode value of given type-decodeBytesWithReturnedLength:
- Decode raw bytes-encodeBytes:length:
- Encode raw bytes-encodeObject:
- Encode an object-decodeObject
- Decode an object
-
For class clusters:
- Must decode during
decodeWithCoder:
- Substitute instance in
-initWithCoder
- Only look at pure data in
-initWithCoder
, not references - Example: NSData can do all in
-initWithCoder:
, NSArray cannot
- Must decode during
-
Future planned feature:
-encodeDecodeWithCoder:
- Combined encode/decode method to reduce duplicate code