Class: Zip::Inflater
- Inherits:
-
Decompressor
- Object
- Decompressor
- Zip::Inflater
- Defined in:
- lib/zip/inflater.rb
Overview
:nodoc:all
Constant Summary
Constants inherited from Decompressor
Instance Attribute Summary
Attributes inherited from Decompressor
#decompressed_size, #input_stream
Instance Method Summary collapse
- #eof? ⇒ Boolean (also: #eof)
-
#initialize(*args) ⇒ Inflater
constructor
A new instance of Inflater.
- #read(maxlen = nil) ⇒ Object
Methods inherited from Decompressor
decompressor_classes, find_by_compression_method, register
Constructor Details
#initialize(*args) ⇒ Inflater
Returns a new instance of Inflater.
5 6 7 8 9 10 |
# File 'lib/zip/inflater.rb', line 5 def initialize(*args) super @buffer = +''.b @zlib_inflater = ::Zlib::Inflate.new(-Zlib::MAX_WBITS) end |
Instance Method Details
#eof? ⇒ Boolean Also known as: eof
24 25 26 |
# File 'lib/zip/inflater.rb', line 24 def eof? @buffer.empty? && input_finished? end |
#read(maxlen = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/zip/inflater.rb', line 12 def read(maxlen = nil) return (maxlen.nil? || maxlen.zero? ? '' : nil) if eof? while maxlen.nil? || (@buffer.bytesize < maxlen) break if input_finished? @buffer << produce_input end @buffer.slice!(0...(maxlen || @buffer.bytesize)) end |