- Inherits from:
- NSData : NSObject
- Package:
- com.apple.yellow.foundation
An NSMutableData object stores mutable data in the form of bytes.
NSMutableData | Creates an NSMutableData object |
The NSMutableData class declares the programmatic interface to an object that contains modifiable data in the form of bytes. setLength allows you to truncate or extend the length of a mutable data object.
increaseLengthBy also allows you to change the length of a mutable data object.
The appendData method lets 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 zeros (using the resetBytesInRange method).
- Constructors
- NSMutableData
- Adjusting capacity
- increaseLengthBy
- setLength
- Adding data
- appendData
- Modifying data
- resetBytesInRange
- setData
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 anURL)
Creates a data object with the data from the location specified by anURL.
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.
public void appendData(NSData otherData)
Appends the contents of a data object otherData to the receiver.
public void increaseLengthBy(int extraLength)
Increases the length of the receiver by extraLength. The additional bytes are all set to zero.
See Also: setLength
public void resetBytesInRange(NSRange range)
Specifies a range within the contents of a mutable data object to be replaced by zeros. 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.
public void setData(NSData aData)
Replaces the entire contents of the receiver with the contents of aData.
public void setLength(int length)
Extends or truncates a mutable data object to length. If the mutable data object is extended, the additional bytes are filled with zero.
See Also: increaseLengthBy