Skip to content

Commit

Permalink
Add Decompressor#input_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
jspanjers committed Jan 8, 2020
1 parent 6cc6717 commit 6f90c6e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/zip/decompressor.rb
Expand Up @@ -14,6 +14,7 @@ def self.find_by_compression_method(compression_method)
decompressor_classes[compression_method]
end

attr_reader :input_stream
attr_reader :decompressed_size

def initialize(input_stream, decompressed_size = nil)
Expand Down
2 changes: 1 addition & 1 deletion lib/zip/inflater.rb
Expand Up @@ -34,7 +34,7 @@ def zlib_inflater
def produce_input
retried = 0
begin
zlib_inflater.inflate(@input_stream.read(Decompressor::CHUNK_SIZE))
zlib_inflater.inflate(input_stream.read(Decompressor::CHUNK_SIZE))
rescue Zlib::BufError
raise if retried >= 5 # how many times should we retry?
retried += 1
Expand Down
2 changes: 1 addition & 1 deletion lib/zip/pass_thru_decompressor.rb
Expand Up @@ -13,7 +13,7 @@ def read(length = nil, outbuf = '')
end

@read_so_far += length
@input_stream.read(length, outbuf)
input_stream.read(length, outbuf)
end

def eof
Expand Down

0 comments on commit 6f90c6e

Please sign in to comment.