Class: Cabriolet::Decompressors::None
- Defined in:
- lib/cabriolet/decompressors/none.rb
Overview
None handles uncompressed data (no compression)
Instance Attribute Summary
Attributes inherited from Base
#buffer_size, #input, #io_system, #output
Instance Method Summary collapse
-
#decompress(bytes) ⇒ Integer
Decompress (copy) the specified number of bytes.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Cabriolet::Decompressors::Base
Instance Method Details
#decompress(bytes) ⇒ Integer
Decompress (copy) the specified number of bytes
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cabriolet/decompressors/none.rb', line 11 def decompress(bytes) total_copied = 0 while total_copied < bytes chunk_size = [bytes - total_copied, @buffer_size].min data = @io_system.read(@input, chunk_size) break if data.empty? @io_system.write(@output, data) total_copied += data.bytesize end total_copied end |