NSString or NSData
NSString or NSData
- Subject: NSString or NSData
- From: The Baur Family <email@hidden>
- Date: Wed, 21 Jul 2004 16:17:13 -0700
I've been changing my mind which is the best in the long run, and at
this point I'm just confusing myself, so I thought I'd ask for advice.
I'm writing a program that will collect the payloads of TCP packets on
the wire and (among other things) reconstruct them. Right now, I just
want the text of the transaction, but eventually I may want to be able
to save off as an image, or some other (arbitrary) file.
I started off using NSString internally to store the data, since I was
inserting RTF commands to format the text with colors to denote
client/server info. Now I'm moving to not inserting the RTF until
displayed, so I can do other manipulations on it, if needed.
The problem I'm running into is that I've been using NSMutableString
methods to replace occurrences of strings and inserting RTF commands
as simple @"" constructs. It seems that NSData gives me less
flexibility to be able to modify the contents before displyaing it,
but I don't want to cause problems if I'm storing binary data in an
NSString. Also, I don't see offhand how to convert NSData back into a
NSString.
What route is the best for this type of application?
Thanks,
Eric
_______________________________________________
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.