Important: The information in this document is obsolete and should not be used for new development.
Inherits from | |
Implements | |
Package | com.apple.cocoa.foundation |
Companion guide |
An NSMutableData object stores mutable data in the form of bytes. The size of the data is subject to a 2GB limit.
A count of the number of bytes in the mutable data object
The sequence of bytes contained in the mutable data object
NSMutableData
Creates an NSMutableData object.
setLength
Extends or truncates the number of bytes in the NSMutableData object.
NSMutableData (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 constructor that takes an NSData or NSMutableData as an argument.
public NSMutableData
()
Creates an empty data object. This method is declared primarily for the use of mutable subclasses of NSData.
public NSMutableData
(java.net.URL aURL)
Creates a data object with the data from the location specified by aURL.
public NSMutableData
(NSData aData)
Creates a data object containing the contents of another data object, aData.
public NSMutableData
(int length)
Creates data object with enough memory to hold length bytes. Fills the object with zeros up to length.
Appends the contents of a data object otherData to the receiver.
public void appendData
(NSData otherData)
Increases the length of the receiver by extraLength.
public void increaseLengthBy
(int extraLength)
The additional bytes are all set to 0.
Specifies a range within the contents of the receiver to be replaced by zeros.
public void resetBytesInRange
(NSRange range)
If the location of range isn’t within the receiver’s range of bytes, a RangeException
is thrown. The receiver is resized to accommodate the new bytes, if necessary.
Replaces the entire contents of the receiver with the contents of aData.
public void setData
(NSData aData)
Extends or truncates a mutable data object to length.
public void setLength
(int length)
If the mutable data object is extended, the additional bytes are filled with zeros.
© 1997, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-07-24)