Sha256: 5328da2c9f4fcb7f505b39d68a618bdcfe4fd1418f5238ed81f424ed60cdc2a4
Contents?: true
Size: 636 Bytes
Versions: 4
Compression:
Stored size: 636 Bytes
Contents
class ZipTricks::FileReader::StoredReader def initialize(from_io, compressed_data_size) @io = from_io @compressed_data_size = compressed_data_size @already_read = 0 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 compressed_chunk end def eof? @already_read >= @compressed_data_size end end
Version data entries
4 entries across 4 versions & 1 rubygems