EncodeObject & DecodeObject Revisted
EncodeObject & DecodeObject Revisted
- Subject: EncodeObject & DecodeObject Revisted
- From: email@hidden
- Date: Thu, 30 May 2002 01:03:01 EDT
Thank you all for the discussion regarding using EncodeObject & DecodeObject.
I am using the fix mmalc offered:
NSArchiver *a_archiver = [[[NSArchiver alloc] initForWritingWithMutableData:
[NSMutableData data]] autorelease];
And this solved my problems.
Now I have read Aaron Hillegass' book, and use archivedDataWithRootObject
while implementing Coder protocols, just with other programs. Usually it is
best when the data stored in the object is variable size (ie. a collection),
like a sketch program. I just find it a bit much to do that when your data is
hardcoded in the document object.
HOWEVER!!
This brings up an interesting point. The encodeObject call stores not only
the data of the object, but also information regarding the object type. The
decodeObject uses that stored data to construct the correct object type, with
correct data. Shouldn't there be a call that just stores the Objects data,
and another one that reads the data back into already created object. This
way the information about what type of object need not be saved.
This would reduce file size, and also allow some cross-platform compatibility
(saving only byes and unicode info).
I know you can use encodeByte/decodeByte, encodeChar/decodeChar,
encodeLong/decodeLong and various others flavors to decode/encode strictly a
byte, char, long, etc. Notice there is no Unicode version of this call.
Still, I want an object, say NSNumber to use the correct calls, depending on
it's data, without encoding what type of object it is.
Am I missing something?
The
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.