NSMutableData
class NSMutableData
class NSMutableData
import Foundation
class NSData
protocol BidirectionalCollection<Element> : Collection where Self.Indices : BidirectionalCollection, Self.SubSequence : BidirectionalCollection
A collection that supports backward as well as forward traversal.
protocol Collection<Element> : Sequence
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 : RandomAccessCollection where Self.Element == UInt8, Self.SubSequence : DataProtocol
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
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 adopt NSCopying
instead.
protocol NSObjectProtocol : AnyObject
The NSObjectProtocol
groups methods that are fundamental to all Foundation objects.
protocol NSSecureCoding : NSCoding
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<Element> : BidirectionalCollection where Self.Indices : RandomAccessCollection, Self.SubSequence : RandomAccessCollection
A collection that supports efficient random-access index traversal.
protocol Sequence<Element>
A type that provides sequential, iterated access to its elements.
override init()
override init?(base64Encoded base64Data: Data, options: NSData.Base64DecodingOptions = [])
override init?(base64Encoded base64Data: String, options: NSData.Base64DecodingOptions = [])
override init(bytes: UnsafeRawPointer?, length: Int)
Initializes a data object filled with a given number of bytes copied from a given buffer.
override init(bytesNoCopy bytes: UnsafeMutableRawPointer, length: Int)
override init(bytesNoCopy bytes: UnsafeMutableRawPointer, length: Int, deallocator: ((UnsafeMutableRawPointer, Int) -> Void)? = nil)
override init(bytesNoCopy bytes: UnsafeMutableRawPointer, length: Int, freeWhenDone: Bool)
init?(capacity: Int)
Returns an initialized mutable data object capable of holding the specified number of bytes.
required init?(coder aDecoder: NSCoder)
override init?(contentsOf url: URL)
override init(contentsOf url: URL, options: NSData.ReadingOptions = []) throws
override init?(contentsOfFile path: String)
override init(contentsOfFile path: String, options: NSData.ReadingOptions = []) throws
override init(data: Data)
init?(length: Int)
Initializes and returns a mutable data object containing a given number of zeroed bytes.
override var length: Int { get set }
The number of bytes contained in the mutable data object.
var mutableBytes: UnsafeMutableRawPointer { get }
A pointer to the data contained by the mutable data object.
func append(_ other: Data)
Appends the content of another data object to the data object.
func append(_ bytes: UnsafeRawPointer, length: Int)
Appends to the data object a given number of bytes from a given buffer.
override func copy(with zone: NSZone? = nil) -> Any
func increaseLength(by extraLength: Int)
Increases the length of the data object by a given number of bytes.
func replaceBytes(in range: NSRange, withBytes bytes: UnsafeRawPointer)
Replaces with a given set of bytes a given range within the contents of the data object.
func replaceBytes(in range: NSRange, withBytes replacementBytes: UnsafeRawPointer?, length replacementLength: Int)
Replaces with a given set of bytes a given range within the contents of the data object.
func resetBytes(in range: NSRange)
Replaces with zeroes the contents of the data object in a given range.
func setData(_ data: Data)
Replaces the entire contents of the data object with the contents of another data object.