init()
init(capacity: Int)
init(count: Int)
func resetBytes (in: Range<Data.Index>)
0
.
あるデータバッファの領域を0
に設定します。
Availability 有効性
Technology
@frozen struct Data
The Data
value type allows simple byte buffers to take on the behavior of Foundation objects. You can create empty or pre-populated buffers from a variety of sources and later add or remove bytes. You can filter and sort the content, or compare against other buffers. You can manipulate subranges of bytes and iterate over some or all of them.
Data
値型は、単純なバイトバッファにFoundationオブジェクトの挙動を取ることを可能にします。あなたは、空のまたは事前入力されたバッファをさまざまなソースから作成して、そして後でバイトを追加または除去できます。あなたは、内容をフィルタおよびソート、または他のバッファと比較できます。あなたは、バイトの下位範囲を操作できます、そしてそれらの幾つかまたは全てにわたって反復できます。
Data
bridges to the NSData
class and its mutable subclass, NSMutable
. You can use these interchangeably in code that interacts with Objective-C APIs.
Data
は、NSData
クラスとそれの可変のサブクラス、NSMutable
にブリッジします。あなたは、Objective-C APIと相互作用するコードにおいて、それらを交換可能に使用できます。
init()
init(capacity: Int)
init(count: Int)
func resetBytes (in: Range<Data.Index>)
0
.
あるデータバッファの領域を0
に設定します。
init()
init<S>(S)
init<SourceType>( buffer: UnsafeBufferPointer<SourceType>)
init<SourceType>( buffer: UnsafeMutableBufferPointer<SourceType>)
init(bytes: UnsafeRawPointer, count: Int)
init(bytesNoCopy : UnsafeMutableRawPointer, count: Int, deallocator: Data.Deallocator)
init(capacity: Int)
init(count: Int)
init(bytes: UnsafeRawPointer, count: Int)
init<SourceType>( buffer: UnsafeBufferPointer<SourceType>)
init<SourceType>( buffer: UnsafeMutableBufferPointer<SourceType>)
init(bytesNoCopy : UnsafeMutableRawPointer, count: Int, deallocator: Data.Deallocator)
enum Data.Deallocator
func write(to: URL, options: Data.WritingOptions)
typealias Data.ReadingOptions
typealias Data.WritingOptions
func base64EncodedData (options: Data.Base64EncodingOptions) -> Data
func base64EncodedString (options: Data.Base64EncodingOptions) -> String
typealias Data.Base64DecodingOptions
typealias Data.Base64EncodingOptions
var isEmpty : Bool
subscript(Range<Data.Index>) -> Data
subscript(Data.Index) -> UInt8
func withUnsafeBytes <ResultType, ContentType>((UnsafePointer<ContentType>) -> ResultType) -> ResultType
func withUnsafeMutableBytes <ResultType, ContentType>((UnsafeMutablePointer<ContentType>) -> ResultType) -> ResultType
func copyBytes (to: UnsafeMutablePointer<UInt8>, count: Int)
func copyBytes (to: UnsafeMutablePointer<UInt8>, from: Range<Data.Index>)
func copyBytes <DestinationType>( to: UnsafeMutableBufferPointer<DestinationType>, from: Range<Data.Index>?) -> Int
func append(Data)
func append<SourceType>(UnsafeBufferPointer<SourceType>)
func append(UnsafePointer<UInt8>, count: Int)
func append(contentsOf : [UInt8])
func reserveCapacity (Int)
func remove(at: Int) -> UInt8
func removeAll (keepingCapacity : Bool)
func removeSubrange (Range<Int>)
func replaceSubrange (Range<Data.Index>, with: Data)
func replaceSubrange <ByteCollection>(Range<Data.Index>, with: ByteCollection)
func replaceSubrange <SourceType>(Range<Data.Index>, with: UnsafeBufferPointer<SourceType>)
func replaceSubrange (Range<Data.Index>, with: UnsafeRawPointer, count: Int)
func first(where: (UInt8) -> Bool) -> UInt8?
func max() -> UInt8?
func max(by: (UInt8, UInt8) -> Bool) -> UInt8?
func min() -> UInt8?
func min(by: (UInt8, UInt8) -> Bool) -> UInt8?
func range(of: Data, options: Data.SearchOptions, in: Range<Data.Index>?) -> Range<Data.Index>?
typealias Data.SearchOptions
func filter((UInt8) -> Bool) -> Data
func prefix(Int) -> Data
func prefix(through: Int) -> Data
func prefix(upTo : Int) -> Data
func prefix(while: (UInt8) -> Bool) -> Data
predicate
returns false
and skipping the remaining elements.
predicate
がfalse
を返すまで冒頭の要素を含んでいて残りの要素を飛ばしている、ある下位シーケンスを返します。
func suffix(Int) -> Data
func suffix(from: Int) -> Data
func dropLast (Int) -> Data
func dropFirst (Int) -> Data
func drop(while: (UInt8) -> Bool) -> Data
predicate
returns true
and returning the remaining elements.
predicate
がtrue
を返す間は要素を飛ばして残りの要素を返すことによって、ある下位シーケンスを返します。
func advanced(by: Int) -> Data
func reduce<Result>(Result, (Result, UInt8) -> Result) -> Result
var lazy: LazySequence<Data>
map
and filter
, are implemented lazily.
このシーケンスと同じ要素を含んでいるシーケンス、しかしそれの上で何らかの演算、例えばmap
やfilter
が遅延に実装されます。
func forEach ((UInt8) -> Void)
for
-in
loop.
指定されたクロージャをそのシーケンスの各要素上でfor
-in
ループと同じ順番で呼び出します。
func enumerated() -> EnumeratedSequence<Data>
func makeIterator () -> Data.Iterator
struct Data.Iterator
func enumerateBytes ((UnsafeBufferPointer<UInt8>, Data.Index, inout Bool) -> Void)
func sort(by: (UInt8, UInt8) -> Bool)
func sorted() -> [UInt8]
func sorted(by: (UInt8, UInt8) -> Bool) -> [UInt8]
func reversed() -> ReversedCollection<Data>
func subdata(in: Range<Data.Index>) -> Data
func split(maxSplits : Int, omittingEmptySubsequences : Bool, whereSeparator : (UInt8) -> Bool) -> [Data]
func split(separator: UInt8, maxSplits : Int, omittingEmptySubsequences : Bool) -> [Data]
static func == (Data, Data) -> Bool
func elementsEqual <OtherSequence>(OtherSequence) -> Bool
func starts<PossiblePrefix>( with: PossiblePrefix) -> Bool
func lexicographicallyPrecedes <OtherSequence>(OtherSequence) -> Bool
<
) to compare elements.
そのシーケンスが別のシーケンスの前に来るかどうかを、ある語彙筆記的順序(字典)順序において、より小さい演算子(<
)を使って要素を比較して、指し示すブール値を返します。
func lexicographicallyPrecedes <OtherSequence>(OtherSequence, by: (UInt8, UInt8) -> Bool) -> Bool
typealias Data.Index
var startIndex : Data.Index
var endIndex : Data.Index
func index(after: Data.Index) -> Data.Index
func index(before: Data.Index) -> Data.Index
typealias Data.Indices
var description: String
var debugDescription : String
var customMirror : Mirror
var hashValue : Int
typealias Data.ReferenceType
init<S>(bytes: S)
Deprecated
非推奨
var first: UInt8?
var last: UInt8?
var underestimatedCount : Int
func allSatisfy ((UInt8) -> Bool) -> Bool
func append(UInt8)
func append<S>(contentsOf : S)
func applying(CollectionDifference<UInt8>) -> Data?
func compactMap <ElementOfResult>((UInt8) -> ElementOfResult?) -> [ElementOfResult]
nil
results of calling the given transformation with each element of this sequence.
指定された変換をこのシーケンスの各要素で呼び出す結果で非-nil
のものを含んでいる配列を返します。
func contains(UInt8) -> Bool
func contains(where: (UInt8) -> Bool) -> Bool
func difference<C>(from: C) -> CollectionDifference<UInt8>
func difference<C>(from: C, by: (C.Element, UInt8) -> Bool) -> CollectionDifference<UInt8>
func elementsEqual <OtherSequence>(OtherSequence, by: (UInt8, OtherSequence.Element) -> Bool) -> Bool
func firstIndex (of: UInt8) -> Int?
func firstIndex (where: (UInt8) -> Bool) -> Int?
func flatMap <SegmentOfResult>((UInt8) -> SegmentOfResult) -> [SegmentOfResult.Element]
func formIndex (inout Int, offsetBy : Int)
func formIndex (inout Int, offsetBy : Int, limitedBy : Int) -> Bool
func formIndex (after: inout Int)
func formIndex (before: inout Int)
func index(Int, offsetBy : Int, limitedBy : Int) -> Int?
func index(of: UInt8) -> Int?
func insert(UInt8, at: Int)
func insert<C>(contentsOf : C, at: Int)
func last(where: (UInt8) -> Bool) -> UInt8?
func lastIndex (of: UInt8) -> Int?
func lastIndex (where: (UInt8) -> Bool) -> Int?
func map<T>((UInt8) -> T) -> [T]
func partition(by: (UInt8) -> Bool) -> Int
func popFirst () -> UInt8?
func popLast () -> UInt8?
func randomElement () -> UInt8?
func randomElement <T>(using: inout T) -> UInt8?
func reduce<Result>(into: Result, (inout Result, UInt8) -> ()) -> Result
func removeAll (where: (UInt8) -> Bool)
func removeFirst () -> UInt8
func removeFirst (Int)
func removeLast () -> UInt8
func removeLast (Int)
func removeSubrange <R>(R)
func replaceSubrange <C, R>(R, with: C)
func reverse()
func shuffle()
func shuffle<T>(using: inout T)
func shuffled() -> [UInt8]
func shuffled<T>(using: inout T) -> [UInt8]
func sort()
func starts<PossiblePrefix>( with: PossiblePrefix, by: (UInt8, PossiblePrefix.Element) -> Bool) -> Bool
func swapAt (Int, Int)
func withContiguousMutableStorageIfAvailable <R>((inout UnsafeMutableBufferPointer<UInt8>) -> R) -> R?
func withContiguousStorageIfAvailable <R>((UnsafeBufferPointer<UInt8>) -> R) -> R?
subscript<R>(R) -> Data
static func != (Data, Data) -> Bool
static func + <Other>(Other, Data) -> Data
static func + <Other>(Data, Other) -> Data
static func + <Other>(Data, Other) -> Data
static func += <Other>(inout Data, Other)
protocol DataProtocol
protocol MutableDataProtocol
protocol ContiguousBytes