On Jul 14, 2014, at 12:15 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> wrote:

> Okay, 1 last question on this. Is there a way to promote-in-place an NSData 
> object into an NSMutableData object?  -becomeMutable or some such? I'm trying 
> to avoid copying megabytes of data/sec if it's avoidable.

Nope. Part of the contract of an NSData object is that it’s immutable. If you 
could change it to mutable, other code that had a reference to that object 
could find its data changing out from underneath it, causing trouble.

If you’re the one creating the NSData object in the first place, can you create 
it as an NSMutableData? Then you won’t have to make any copies.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to