NSMutableData capacity
NSMutableData capacity
- Subject: NSMutableData capacity
- From: Andreas Grosam <email@hidden>
- Date: Wed, 23 May 2012 17:26:50 +0200
Is there an easy way to figure out the capacity of a NSMutableData object - that is the number of bytes that can be written to the data object without causing it to reallocate the internal buffer or invalidating the base pointer to the internal buffer?
Example:
NSMutableData* data = ..
[data increaseLengthBy:1234];
void * p = [data mutableBytes];
NSUInteger data_capacity = [data capacity]; // An API like this would be fine!
[data setLength: data_capacity];
assert(p == [data mutableBytes]);
That would be a "nice to have" feature. I wouldn't use an approach that requires tricky hacks into the allocator.
Any ideas?
Regards
Andreas
_______________________________________________
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