5

What is the difference between NSData and NSMutableData?

exebook
  • 32,014
  • 33
  • 141
  • 226
Mr.savaliya
  • 259
  • 2
  • 8

2 Answers2

3

From the Stack Overflow tag-wikis:

The NSData class is an apple class for holding generic data. Often used when reading/writing from and to files, and the internet.

NSMutableData (and its superclass NSData) provide data objects, object-oriented wrappers for byte buffers.

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
3

NSData is fixed after creation.

NSMutableData, as the name implies, allows operations that change the contents (appendBytes:, appendData, setData:...).

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
DrC
  • 7,528
  • 1
  • 22
  • 37