|
//
// Data+bytes.swift
// PaiAi
//
// Created by LISA on 2017/6/1.
// Copyright © 2017年 yb. All rights reserved.
//
import UIKit
extension Data {
public func arrayOfBytes() -> [UInt8] {
let count = self.count / MemoryLayout<UInt8>.size
var bytesArray = [UInt8](repeating: 0, count: count)
(self as NSData).getBytes(&bytesArray, length: count * MemoryLayout<UInt8>.size)
return bytesArray
}
}
|