# File lib/mechanize/http/agent.rb, line 1116 def auto_io name, read_size, input_io out_io = StringIO.new out_io.set_encoding Encoding::BINARY if out_io.respond_to? :set_encoding until input_io.eof? do if StringIO === out_io and use_tempfile? out_io.size then new_io = make_tempfile name new_io.write out_io.string out_io = new_io end chunk = input_io.read read_size chunk = yield chunk if block_given? out_io.write chunk end out_io.rewind out_io end