Basically what I would like is an NSMutableData method like this: - (void)resetDataRangeTo:(NSRange)range
Parameters range The range within the contents of the receiver to be considered the new contents. But, since that doesn't exist yet, is it safe to "shift" the contents in place of an NSMutableData? I'm trying to avoid having to copy the contents, which is > 1MB. In this example, I want to remove the leading 1024 bytes in a large NSMutableData: NSMutableData *bigData = ... // (approx 1MB of data); UInt64 byte_shift = 1024; // skip over first 1024 bytes UInt64 new_length = bigMutData.length-byte_shift; NSRange moveRange = NSMakeRange(0,new_length); [bigMutData replaceBytesInRange:moveRange withBytes:bigMutData.bytes+1024 length:new_length]; [bigMutData setLength:new_length]; -Carl _______________________________________________ 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