# File lib/http/form_data/composite_io.rb, line 31 def read(length = nil, outbuf = nil) outbuf = outbuf.to_s.clear # buffer in JRuby is sometimes US-ASCII, force to ASCII-8BIT outbuf.force_encoding(Encoding::BINARY) while current_io current_io.read(length, @buffer) outbuf << @buffer.force_encoding(Encoding::BINARY) if length length -= @buffer.bytesize break if length.zero? end advance_io end outbuf unless length && outbuf.empty? end