On 15 Jul 2014, at 00:32, Jens Alfke j...@mooseyard.com wrote:
On Jul 14, 2014, at 1:07 PM, Carl Hoefs newsli...@autonomy.caltech.edu
wrote:
modifiableData = [ NSMutableData dataWithData: [ external call that gives
me an NSData ] ];
It’s shorter and more idiomatic to just say
On Jul 15, 2014, at 1:45 AM, Mike Abdullah mabdul...@karelia.com wrote:
Another possibility is to use dispatch_data. Rather than copy bytes around to
assemble them into a contiguous buffer, your use case might be just as well
suited to dispatch_data’s approach of tying together various
On Jul 15, 2014, at 9:50 AM, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
Awesome! I had been wondering if this concept existed in Cocoa, didn't see it
in the NSData docs. It's sort of like using iovec structs with readv/writev
for sockets. I would primarily use the
On Jul 15, 2014, at 10:20 AM, Jens Alfke j...@mooseyard.com wrote:
On Jul 15, 2014, at 9:50 AM, Carl Hoefs newsli...@autonomy.caltech.edu
wrote:
Awesome! I had been wondering if this concept existed in Cocoa, didn't see
it in the NSData docs. It's sort of like using iovec structs with
Okay, now if I want to insert 1024 bytes of new data at the beginning of a
populated NSMutableArray, is there a better way than this:
NSMutableData *bigMData = ... // (approx 1MB of data);
int origlength = bigMData.length;
uint8_t *newBytesPtr = ...
. . .
// Shift contents
On 14 Jul 2014, at 19:12, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
Okay, now if I want to insert 1024 bytes of new data at the beginning of a
populated NSMutableArray, is there a better way than this:
Yes.
[bigMData replaceBytesInRange:NSMakeRange(0,0)
On 14 Jul 2014, at 11:12 am, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
Okay, now if I want to insert 1024 bytes of new data at the beginning of a
populated NSMutableArray, is there a better way than this:
Sure; why not just do [bigMData replaceBytesInRange:NSMakeRange(0,0)
On Jul 14, 2014, at 11:22 AM, Mike Abdullah mabdul...@karelia.com wrote:
[bigMData replaceBytesInRange:NSMakeRange(0,0)
withBytes:newBytesPtr
length:1024];
On Jul 14, 2014, at 11:23 AM, Ben Kennedy b...@zygoat.ca
On 14 Jul 2014, at 11:30 am, Carl Hoefs newsli...@autonomy.caltech.edu 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
On Jul 14, 2014, at 11:35 AM, Ben Kennedy b...@zygoat.ca wrote:
On 14 Jul 2014, at 11:30 am, Carl Hoefs newsli...@autonomy.caltech.edu
wrote:
[bigMData replaceBytesInRange:NSMakeRange(0,0) withBytes:newBytesPtr
length:1024];
Wow, that's damn clever! My thinking is so clunky. It never
On Jul 14, 2014, at 11:48 AM, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
Yes, I guess it's the semantics that threw me. I was attempting to
insertBytesInRange not replaceBytesInRange, so I had it in my mind that
the one couldn't do the other. But that's the whole purpose of the
On Jul 14, 2014, at 11:54 AM, Jens Alfke j...@mooseyard.com wrote:
On Jul 14, 2014, at 11:48 AM, Carl Hoefs newsli...@autonomy.caltech.edu
wrote:
Yes, I guess it's the semantics that threw me. I was attempting to
insertBytesInRange not replaceBytesInRange, so I had it in my mind that
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.
The reason you can't do exactly what you're asking is because there may be
other owners of the immutable object. Since NSMutableData is a subclass of
NSData, you should ask yourself where you're creating the object and try
creating it from the start as mutable, and also if there are owners of
On Jul 14, 2014, at 12:57 PM, Gary L. Wade garyw...@desisoftsystems.com
wrote:
where you're creating the object
On Jul 14, 2014, at 12:53 PM, Jens Alfke j...@mooseyard.com wrote:
If you’re the one creating the NSData object in the first place, can you
create it as an NSMutableData?
On Jul 14, 2014, at 1:07 PM, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
modifiableData = [ NSMutableData dataWithData: [ external call that gives
me an NSData ] ];
It’s shorter and more idiomatic to just say
modifiableData = [external mutableCopy];
(plus an autorelease if
On 15 Jul 2014, at 4:54 am, Jens Alfke j...@mooseyard.com wrote:
The equivalent function in the ‘classic’ Mac OS had the very appropriate name
of Munger( ) since it would munge bytes around in a heap block. Knowing how
to use Munger was a sign of geek cred in the old (80s-90s) Mac dev
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
don’t you just want:
[bigData replaceBytesInRange:NSMakeRange(0, 1024) withBytes:NULL length:0];
??
I am sure NSMutableData is well optimized for shunting its contents around
internally.
Matt
On 12 Jul 2014, at 20:36, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
Basically what I would
On Jul 12, 2014, at 1:51 PM, Matt Gough devlists...@gmail.com wrote:
[bigData replaceBytesInRange:NSMakeRange(0, 1024) withBytes:NULL length:0];
Wow, I would never have thought to do that! Works perfectly!
Thx,
-Carl
___
Cocoa-dev mailing list
On Saturday, July 12, 2014, Carl Hoefs newsli...@autonomy.caltech.edu
wrote:
On Jul 12, 2014, at 1:51 PM, Matt Gough devlists...@gmail.com
javascript:; wrote:
[bigData replaceBytesInRange:NSMakeRange(0, 1024) withBytes:NULL
length:0];
Wow, I would never have thought to do that! Works
21 matches
Mail list logo