2 // Data+OAuthSwift.swift
5 // Created by Dongri Jin on 1/28/15.
6 // Copyright (c) 2015 Dongri Jin. All rights reserved.
13 internal init(data: Data) {
18 internal mutating func append(_ bytes: [UInt8]) {
19 self.append(bytes, count: bytes.count)
21 internal mutating func append(_ byte: UInt8) {
24 internal mutating func append(_ byte: UInt16) {
25 append(UInt8(byte >> 0 & 0xFF))
26 append(UInt8(byte >> 8 & 0xFF))
28 internal mutating func append(_ byte: UInt32) {
29 append(UInt16(byte >> 0 & 0xFFFF))
30 append(UInt16(byte >> 16 & 0xFFFF))
32 internal mutating func append(_ byte: UInt64) {
33 append(UInt32(byte >> 0 & 0xFFFFFFFF))
34 append(UInt32(byte >> 32 & 0xFFFFFFFF))
39 /* let count = self.count / MemoryLayout<UInt8>.size
40 var bytesArray = [UInt8](repeating: 0, count: count)
41 self.copyBytes(to:&bytesArray, count: count * MemoryLayout<UInt8>.size)