Open ClassFoundation5.9.0
NSMutableData
class NSMutableData
Superclasses
Citizens in Foundation
Conformances
protocol BidirectionalCollection
A collection that supports backward as well as forward traversal.
protocol Collection
A sequence whose elements can be traversed multiple times, nondestructively, and accessed by an indexed subscript.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol DataProtocol
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol NSCoding
The
NSCoding
protocol declares the two methods that a class must implement so that instances of that class can be encoded and decoded. This capability provides the basis for archiving (where objects and other structures are stored on disk) and distribution (where objects are copied to different address spaces).protocol NSCopying
The
NSCopying
protocol declares a method for providing functional copies of an object. The exact meaning of “copy” can vary from class to class, but a copy must be a functionally independent object with values identical to the original at the time the copy was made.protocol NSMutableCopying
The
NSMutableCopying
protocol declares a method for providing mutable copies of an object. Only classes that define an “immutable vs. mutable” distinction should adopt this protocol. Classes that don’t define such a distinction should adoptNSCopying
instead.protocol NSObjectProtocol
The
NSObjectProtocol
groups methods that are fundamental to all Foundation objects.protocol NSSecureCoding
Conforming to the
NSSecureCoding
protocol indicates that an object handles encoding and decoding instances of itself in a manner that is robust against object substitution attacks.protocol RandomAccessCollection
A collection that supports efficient random-access index traversal.
protocol Sequence
A type that provides sequential, iterated access to its elements.
Members
init(
) init?(base64Encoded: Data, options: NSData.Base64DecodingOptions
) init?(base64Encoded: String, options: NSData.Base64DecodingOptions
) init(bytes: UnsafeRawPointer?, length: Int
) Initializes a data object filled with a given number of bytes copied from a given buffer.
init(bytesNoCopy: UnsafeMutableRawPointer, length: Int
) init(bytesNoCopy: UnsafeMutableRawPointer, length: Int, deallocator: ((UnsafeMutableRawPointer, Int) -> Void)?
) init(bytesNoCopy: UnsafeMutableRawPointer, length: Int, freeWhenDone: Bool
) init?(capacity: Int
) Returns an initialized mutable data object capable of holding the specified number of bytes.
init?(coder: NSCoder
) init?(contentsOf: URL
) init(contentsOf: URL, options: NSData.ReadingOptions
) throws init?(contentsOfFile: String
) init(contentsOfFile: String, options: NSData.ReadingOptions
) throws init(data: Data
) init?(length: Int
) Initializes and returns a mutable data object containing a given number of zeroed bytes.
var length: Int
The number of bytes contained in the mutable data object.
var mutableBytes: UnsafeMutableRawPointer
A pointer to the data contained by the mutable data object.
func append(Data
) Appends the content of another data object to the data object.
func append(UnsafeRawPointer, length: Int
) Appends to the data object a given number of bytes from a given buffer.
func copy(with: NSZone?
) -> Any func increaseLength(by: Int
) Increases the length of the data object by a given number of bytes.
func replaceBytes(in: NSRange, withBytes: UnsafeRawPointer
) Replaces with a given set of bytes a given range within the contents of the data object.
func replaceBytes(in: NSRange, withBytes: UnsafeRawPointer?, length: Int
) Replaces with a given set of bytes a given range within the contents of the data object.
func resetBytes(in: NSRange
) Replaces with zeroes the contents of the data object in a given range.
func setData(Data
) Replaces the entire contents of the data object with the contents of another data object.