Questions tagged [nsmutabledata]

NSMutableData (and its superclass NSData) provide data objects, object-oriented wrappers for byte buffers. It is available in OS X v10.0 and later and available in iOS 2.0 and later .Use this tag [tag:NSMutableData] for questions referring to NSMutableData in OS X or iOS platform .

From Apple Official Document NSMutableData class reference (and its superclass NSData) provide data objects, object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Foundation objects. They are typically used for data storage and are also useful in Distributed Objects applications, where data contained in data objects can be copied or moved between applications.

NSData creates static data objects, and NSMutableData creates dynamic data objects. You can easily convert one type of data object to the other with the initializer that takes an NSData object or an NSMutableData object as an argument.

For more information : NSMutableData Class Reference

Related SO Questions:

NSMutableData remove bytes?

Is it okay to call +[NSData dataWithData:] with an NSMutableData object?

Related tags:

155 questions
0
votes
1 answer

Purge the contents of a data container in real time

My problem is best explained by the architecture below Basically, I have to purge the contents of an NSMutableData object (or any other object, for that matter) in real time, i.e., I can't block its containing thread. Is there a way/API to do…
abbood
  • 23,101
  • 16
  • 132
  • 246
0
votes
2 answers

Appending binary string to NSMutableData

How would I go about appending this binary string 111000111000111111000111000111 to an NSMutableData object that contains a png (NSMutableData *dataForPNGFile = UIImagePNGRepresentation(p.Image);)
Dann
  • 323
  • 5
  • 17
0
votes
1 answer

Recombining NSData objects after a download

I broke up a file into 50 mb packets on the server side and when I receive it on the iPad, I receive as NSData object through NSURLConnection. To restitch the data, do I create an empty NSMutableData object and just appendData the packets back…
Crystal
  • 28,460
  • 62
  • 219
  • 393
0
votes
2 answers

Saving and retrieving Sint16 from NSMutableData

I need somewhere to save and then to retrieve Sint16 (2 bytes). I get: SInt16* frames = (SInt16*)inBuffer->mAudioData; and want to save &frames[i] somewhere (NSMutableData?) that could later easily retrieve. I tried to save like this (in…
Streetboy
  • 4,351
  • 12
  • 56
  • 101
0
votes
3 answers

how to reverse order of NSMutableData

I want to reverse bytes of NSMutableData. I am generating nsmutabledata object from a audio file. and playing it using data. my purpose is play audio reverse. If I can reverse the NSMutableData I will be success. Here is my code NSString…
Shivomkara Chaturvedi
  • 1,697
  • 7
  • 28
  • 42
0
votes
2 answers

How to assign NSString directly to NSMutableData?

I am developing an application including sqlite database. I want to encrypt and decrypt data's inside the database using AES encryption. I have successfully implemented the AES encryption and inserted the encrypted data's in the database. And am…
John
  • 734
  • 3
  • 14
  • 30
0
votes
1 answer

Difference between [[NSMutableData alloc] initWithLength:] and CFDataCreateMutable()?

I'm looking at some code that creates a mutable data object and puts a SHA1 hash into it. If I initialize the target mutable data object with CFMutableDataRef hashDataRef = (CFMutableDataRef)[[NSMutableData alloc]…
Isaac
  • 10,668
  • 5
  • 59
  • 68
0
votes
2 answers

Verifying resetBytesInRange in NSMutableData

I have a huge NSMutableData object(approximately 1 MB in size) in memory and now I want to replace all the bytes in the object to 0 (not deallocate the memory). The resetBytesInRange method lets me do this. However how do I verify/check if the bytes…
vivek
  • 41
  • 1
  • 6
0
votes
1 answer

How to assign different data types to NSMutableData

I'm trying to create a vertex attribute array for storing vectors and indices in a mesh. I realise that vertex attributes can be made up from vector2, vector3 and/or vector4 so i'd like to create a class that caters for them all without constraining…
Zack Brown
  • 5,990
  • 2
  • 41
  • 54
0
votes
1 answer

NSMutableData appendData with NSArray data

To append a simple string key-value pair, we do this in object C NSMutableData *body = [NSMutableData data]; [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\";\r\n\r\n%@", _name, _value]…
jason white
  • 687
  • 4
  • 11
  • 28
0
votes
1 answer

Trouble converting NSData to NSArray

(void) connection:(NSURLConnection )connection didReceiveData:(NSData )data { [self.receivedData appendData:data]; // convert data to array // ??? the below is not working NSMutableArray *receivedDataAsArray = [NSPropertyListSerialization …
-1
votes
1 answer

iOS: How to get a specific string from a Data containing Strings and an image?

I have that code that add values to body: let body = NSMutableData() let mimetype = "image/jpg" //define the data post parameter body.append("--\(boundary)\r\n".data(using: String.Encoding.utf8)!) body.append("Content-Disposition:form-data;…
ΩlostA
  • 2,501
  • 5
  • 27
  • 63
-1
votes
1 answer

Parse Mutable Live Data to Array in Kotlin

There is a mutableLiveData Holding 2 array "deal" and "category" I need to parse this both in different adapters. Is there a way I can convert 1 mutable live data to 2 array and then parse them to two different adapters Suppose There is…
-1
votes
1 answer

Objective-C initializing a MutableData structure

When I use this bit of code: NSMutableData *stringMutableData = [[_inputMessageField stringValue] dataUsingEncoding:NSUTF8StringEncoding]; I always get the warning: Incompatible pointer types initializing 'NSMutableData *' with an expression of…
-1
votes
1 answer

NSMutableData replacing bytes

I'm trying to replace bytes in correct order (server sends them in bad order). And I'm having a hard time getting it done. Maybe someone could help me do this correctly Input: < F801 0020 > (NSMutableData) Output: < 2000 01F8 >…
Datenshi
  • 1,191
  • 5
  • 18
  • 56
1 2 3
10
11