Sha256: 01dc62dd377d91441d991159fab62258ceb8d512e6a79bb227cc8dc6af7e0aa0
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
module Zip class PassThruDecompressor < Decompressor #:nodoc:all def initialize(input_stream, chars_to_read) super(input_stream) @chars_to_read = chars_to_read @read_so_far = 0 @has_returned_empty_string = false end def sysread(number_of_bytes = nil, buf = nil) if input_finished? has_returned_empty_string_val = @has_returned_empty_string @has_returned_empty_string = true return '' unless has_returned_empty_string_val return end if (number_of_bytes == nil || @read_so_far + number_of_bytes > @chars_to_read) number_of_bytes = @chars_to_read - @read_so_far end @read_so_far += number_of_bytes @input_stream.read(number_of_bytes, buf) end def produce_input sysread(::Zip::Decompressor::CHUNK_SIZE) end def input_finished? @read_so_far >= @chars_to_read end alias :eof :input_finished? alias :eof? :input_finished? end end # Copyright (C) 2002, 2003 Thomas Sondergaard # rubyzip is free software; you can redistribute it and/or # modify it under the terms of the ruby license.
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
rubyzip-1.0.0 | lib/zip/pass_thru_decompressor.rb |
rubyzip-1.0.0.beta1 | lib/zip/pass_thru_decompressor.rb |
superp-rubyzip-0.1.0 | lib/zip/pass_thru_decompressor.rb |