Sha256: 21e8d9f8525389395e00854ce8a1037be356454637cb9a861f62b94fd6bdfc0a
Contents?: true
Size: 708 Bytes
Versions: 4
Compression:
Stored size: 708 Bytes
Contents
class ZipTricks::FileReader::InflatingReader def initialize(from_io, compressed_data_size) @io = from_io @compressed_data_size = compressed_data_size @already_read = 0 @zlib_inflater = ::Zlib::Inflate.new(-Zlib::MAX_WBITS) end def extract(n_bytes=nil) n_bytes ||= (@compressed_data_size - @already_read) return if eof? available = @compressed_data_size - @already_read return if available.zero? n_bytes = available if n_bytes > available return '' if n_bytes.zero? compressed_chunk = @io.read(n_bytes) @already_read += compressed_chunk.bytesize @zlib_inflater.inflate(compressed_chunk) end def eof? @zlib_inflater.finished? end end
Version data entries
4 entries across 4 versions & 1 rubygems