Class: Zip::Inflater
- Inherits:
-
Decompressor
- Object
- Decompressor
- Zip::Inflater
- Defined in:
- lib/ruby_archive/handlers/rubyzip/zip/zip.rb
Overview
:nodoc:all
Constant Summary
Constants inherited from Decompressor
Instance Method Summary collapse
-
#initialize(inputStream) ⇒ Inflater
constructor
A new instance of Inflater.
-
#input_finished? ⇒ Boolean
(also: #eof, #eof?)
to be used with produce_input, not read (as read may still have more data cached) is data cached anywhere other than @outputBuffer? the comment above may be wrong.
- #produce_input ⇒ Object
- #sysread(numberOfBytes = nil, buf = nil) ⇒ Object
Constructor Details
#initialize(inputStream) ⇒ Inflater
Returns a new instance of Inflater.
176 177 178 179 180 181 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 176 def initialize(inputStream) super @zlibInflater = Zlib::Inflate.new(-Zlib::MAX_WBITS) @outputBuffer="" @hasReturnedEmptyString = ! EMPTY_FILE_RETURNS_EMPTY_STRING_FIRST end |
Instance Method Details
#input_finished? ⇒ Boolean Also known as: eof, eof?
to be used with produce_input, not read (as read may still have more data cached) is data cached anywhere other than @outputBuffer? the comment above may be wrong
204 205 206 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 204 def input_finished? @outputBuffer.empty? && internal_input_finished? end |
#produce_input ⇒ Object
194 195 196 197 198 199 200 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 194 def produce_input if (@outputBuffer.empty?) return internal_produce_input else return @outputBuffer.slice!(0...(@outputBuffer.length)) end end |
#sysread(numberOfBytes = nil, buf = nil) ⇒ Object
183 184 185 186 187 188 189 190 191 192 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 183 def sysread(numberOfBytes = nil, buf = nil) readEverything = (numberOfBytes == nil) while (readEverything || @outputBuffer.length < numberOfBytes) break if internal_input_finished? @outputBuffer << internal_produce_input(buf) end return value_when_finished if @outputBuffer.length==0 && input_finished? endIndex= numberOfBytes==nil ? @outputBuffer.length : numberOfBytes return @outputBuffer.slice!(0...endIndex) end |