23 lines
486 B
Swift
23 lines
486 B
Swift
import Foundation
|
|
|
|
public extension OutputStream {
|
|
|
|
public func write(byte: UInt8) {
|
|
var copy = byte
|
|
write(©, maxLength: 1)
|
|
}
|
|
|
|
public func write(bytes: [UInt8]) {
|
|
var copy = bytes
|
|
write(©, maxLength: bytes.count)
|
|
}
|
|
|
|
public func write(data: Foundation.Data) {
|
|
var dataCopy = data
|
|
let _ = dataCopy.withUnsafeMutableBytes { contents in
|
|
return write(contents, maxLength: data.count)
|
|
}
|
|
}
|
|
|
|
}
|