Contents

CFMutableData

Declaration

class CFMutableData

Overview

CFMutableData manages dynamic binary data. The basic interface for managing binary data is provided by CFData. CFMutableData adds functions to modify the contents of a binary data object.

You create a mutable data object using either the CFDataCreateMutable(_:_:) or CFDataCreateMutableCopy(_:_:_:) function.

Bytes are added to a data object with the CFDataAppendBytes(_:_:_:) function. Bytes are removed from a data object with the CFDataDeleteBytes(_:_:) function.

CFMutableData is “toll-free bridged” with its Cocoa Foundation counterpart, NSMutableData. What this means is that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. In other words, in a method where you see an NSMutableData * parameter, you can pass in a CFMutableDataRef, and in a function where you see a CFMutableDataRef parameter, you can pass in an NSMutableData instance. This also applies to concrete subclasses of NSMutableData. See Toll-Free Bridged Types for more information on toll-free bridging.

Topics

Creating a Mutable Data Object

Accessing Data

Modifying a Mutable Data Object

See Also

Related Documentation

  • Property List Programming Topics for Core Foundation
  • Binary Data Programming Guide for Core Foundation

Opaque Types