instance method
OpenSSL::Buffering#read
(?::Integer? size, ?::String buf) -> ::String?
read(size=nil, buf=nil)
ext/openssl/lib/openssl/buffering.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ext/openssl/lib/openssl/buffering.rb, line 118
def read(size=nil, buf=nil)
if size == 0
if buf
buf.clear
return buf
else
return ""
end
end
until @eof
break if size && size <= @rbuffer.size
fill_rbuff
end
ret = consume_rbuff(size) || ""
if buf
buf.replace(ret)
ret = buf
end
(size && ret.empty?) ? nil : ret
end
Reads size bytes from the stream. If buf is provided it must reference a string which will receive the data.
See IO#read for full details.