Re: [NSMutableData resetDataRangeTo:(NSRange)range];
Re: [NSMutableData resetDataRangeTo:(NSRange)range];
- Subject: Re: [NSMutableData resetDataRangeTo:(NSRange)range];
- From: Ben Kennedy <email@hidden>
- Date: Mon, 14 Jul 2014 11:35:46 -0700
On 14 Jul 2014, at 11:30 am, Carl Hoefs <email@hidden> wrote:
>> [bigMData replaceBytesInRange:NSMakeRange(0,0) withBytes:newBytesPtr length:1024];
>
> Wow, that's damn clever! My thinking is so clunky. It never would have occurred to me that NSMutableData could expand (0,0) into (0,1024) out of thin air! Awesome!
Well, it's basically the inverse of your first question, for which Matt Gough already provided the answer.
NSMutableData's method is well designed and well named because it does exactly as it implies: replaces some range of data (whatever size) with another chunk of data (whatever size).
-ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden