mirror of
https://github.com/GayPizzaSpecifications/darwin-apk.git
synced 2025-08-03 21:41:31 +00:00
zlib-based homecooked gzip reader for significantly faster decompression times
This commit is contained in:
@ -52,6 +52,15 @@ public struct MemoryInputStream: InputStream {
|
||||
return bytes
|
||||
}
|
||||
|
||||
public mutating func read(_ buffer: UnsafeMutablePointer<UInt8>, maxLength count: Int) throws(StreamError) -> Int {
|
||||
let beg = min(self._idx, self._len)
|
||||
let end = min(self._idx + count, self._len)
|
||||
let len = beg.distance(to: end)
|
||||
let buf = UnsafeMutableRawBufferPointer(start: buffer, count: len)
|
||||
self._idx += len
|
||||
return self._sli.copyBytes(to: buf, from: beg..<end)
|
||||
}
|
||||
|
||||
public mutating func next() -> UInt8? {
|
||||
if self._idx < self._len {
|
||||
let byte = self._sli[self._idx]
|
||||
|
Reference in New Issue
Block a user