Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.mac.programmer.help > #63
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!198.186.194.247.MISMATCH!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
|---|---|
| From | silverdr@srebrnysen.com |
| Newsgroups | comp.sys.mac.programmer.help |
| Subject | Re: dataWithBytesNoCopy:length:freeWhenDone |
| Date | Sat, 8 Oct 2011 14:28:41 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 44 |
| Message-ID | <707407.1506.1318109321339.JavaMail.geo-discussion-forums@yqar15> (permalink) |
| References | <b3d9ee72-a379-4769-9ce9-3ffe843144c9@q25g2000vbx.googlegroups.com> <wcyeo-D8EF3C.13353808102011@news.giganews.com> |
| Reply-To | comp.sys.mac.programmer.help@googlegroups.com |
| NNTP-Posting-Host | 77.8.224.35 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | posting.google.com 1318109426 18171 127.0.0.1 (8 Oct 2011 21:30:26 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Sat, 8 Oct 2011 21:30:26 +0000 (UTC) |
| In-Reply-To | <wcyeo-D8EF3C.13353808102011@news.giganews.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=77.8.224.35; posting-account=aItwoAoAAADl77EHHw0OM7wo4ykKlwDL |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| Xref | x330-a1.tempe.blueboxinc.net comp.sys.mac.programmer.help:63 |
Show key headers only | View raw
On Saturday, 8 October 2011 22:35:39 UTC+2, William Yeo wrote: > > I have a question about dealing with binary data. I have a large > > NSMutableData, which I divide into some logical structure creating > > another NSMutableData instances, which are supposed to hold a subset > > of bytes the large instance holds. > > OK > > > Yet I want all the manipulations > > done on the bytes of the "small" instances to be reflected in the > > "large" one. > > You can't do that because the new NSMutableData is a separate entity, so > if you change it, it will create a new area for the modified information > so it will not corrupt the data in any of the other objects. I see. That's more or less what I am experiencing. I thought the "NoCopy" part would prevent it from doing this. > If you want all of the changes to be reflected back into the original > string, you'll probably need to create and manage your own data area, > since NSMutableData's purpose in life differs from what you want done. > > If you could elaborate on what you need to do, we might be able to > suggest another mechanism or an alternative. Basically I need to achieve something similar to lying several structs over an array of unsigned chars in C. I have an array of bytes (held in a NSMutableData instance) that I need to parse into distinct objects, manipulate their contents separately yet have that content remain part of the original array of bytes. Something like a file containing document that has its fixed structure. I need to modify elements of this structure and then write the data back to a file without the need for reconstructing the file from various elements. I hope I make it clear.. ? I probably can extract "mutableBytes" from the original NSMutableData instance, lay C structs over them, manipulate them that way and then create another instance from the bytes to write back to the file. But I perceive this approach as sort of last resort.
Back to comp.sys.mac.programmer.help | Previous | Next — Previous in thread | Next in thread | Find similar
dataWithBytesNoCopy:length:freeWhenDone "Silver Dream !" <patrycjusz.logiewa@googlemail.com> - 2011-10-07 16:26 -0700
Re: dataWithBytesNoCopy:length:freeWhenDone William Yeo <wcyeo@shaw.ca> - 2011-10-08 13:35 -0700
Re: dataWithBytesNoCopy:length:freeWhenDone silverdr@srebrnysen.com - 2011-10-08 14:28 -0700
Re: dataWithBytesNoCopy:length:freeWhenDone William Yeo <wcyeo@shaw.ca> - 2011-10-08 16:40 -0700
Re: dataWithBytesNoCopy:length:freeWhenDone "Silver Dream !" <silverdr@srebrnysen.com> - 2011-10-09 05:51 -0700
csiph-web