mirror of
https://bitbucket.org/vendoo/vendoo_v1.0.git
synced 2025-12-26 04:07:40 +00:00
31 lines
718 B
Swift
31 lines
718 B
Swift
//
|
|
// NSData+OAuthSwift.swift
|
|
// OAuthSwift
|
|
//
|
|
// Created by Dongri Jin on 1/28/15.
|
|
// Copyright (c) 2015 Dongri Jin. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension NSMutableData {
|
|
internal func appendBytes(arrayOfBytes: [UInt8]) {
|
|
self.appendBytes(arrayOfBytes, length: arrayOfBytes.count)
|
|
}
|
|
|
|
}
|
|
|
|
extension NSData {
|
|
func bytes() -> [UInt8] {
|
|
let count = self.length / sizeof(UInt8)
|
|
var bytesArray = [UInt8](count: count, repeatedValue: 0)
|
|
self.getBytes(&bytesArray, length:count * sizeof(UInt8))
|
|
return bytesArray
|
|
}
|
|
|
|
class public func withBytes(bytes: [UInt8]) -> NSData {
|
|
return NSData(bytes: bytes, length: bytes.count)
|
|
}
|
|
}
|
|
|