2024-11-10 17:51:53 +11:00
|
|
|
/*
|
|
|
|
* darwin-apk © 2024 Gay Pizza Specifications
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2024-11-08 21:22:33 +11:00
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2024-11-14 00:57:29 +11:00
|
|
|
public class InputStream: Stream, IteratorProtocol {
|
|
|
|
public typealias Element = UInt8
|
2024-11-08 21:22:33 +11:00
|
|
|
|
2024-11-14 00:57:29 +11:00
|
|
|
public func read(_ count: Int) throws(StreamError) -> Data {
|
|
|
|
throw .notImplemented
|
|
|
|
}
|
|
|
|
|
|
|
|
public func read(_ buffer: UnsafeMutablePointer<UInt8>, maxLength len: Int) throws(StreamError) -> Int {
|
|
|
|
throw .notImplemented
|
|
|
|
}
|
|
|
|
|
|
|
|
public func next() -> UInt8? {
|
|
|
|
try? self.read(1).first
|
2024-11-08 21:22:33 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public extension InputStream {
|
2024-11-14 00:57:29 +11:00
|
|
|
func read(_ size: Int, items: Int) throws(StreamError) -> Data {
|
|
|
|
try self.read(size * items)
|
2024-11-08 21:22:33 +11:00
|
|
|
}
|
|
|
|
}
|