Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights Reserved.

NSMutableData

Inherits From: NSData : NSObject

Conforms To: NSCoding, NSCopying, NSMutableCopying (NSData) NSObject (NSObject)

Declared In: Foundation/NSData.h

Foundation/NSSerialization.h

Class Description

The NSMutableData class declares the programmatic interface to objects that contain modifiable data in the form of bytes. This class inherits all read-only access methods from its superclass, NSData, and declares only those methods that permit the modification of the data.

NSMutableData's two primitive methodsmutableBytes and setLength:provide the basis for all the other methods in its interface. The mutableBytes method returns a pointer for writing into the bytes contained in the mutable data object. setLength: allows you to truncate or extend the length of a mutable data object.

The appendBytes:length: and appendData: methods let you append bytes or the contents of another data object to a mutable data object. You can replace a range of bytes in a mutable data object with either zeroes (using the resetBytesInRange: method), or with different bytes (using the replaceBytesInRange:withBytes: method).

This class declares various serialization methods that enable architecture-independent serialization of arbitrary Objective C types.

Creating an NSMutableData Object

Adjusting Capacity

Appending Data

Modifying Data

Serializing Data