ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- U:RDoc::AnyMethod[iI" read:ETI" IO#read;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"2Reads bytes from the stream (in binary mode):;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"+If +maxlen+ is +nil+, reads all bytes.;To;;0; [o; ; [I"2Otherwise reads +maxlen+ bytes, if available.;To;;0; [o; ; [I"Otherwise reads all bytes.;T@o; ; [I"FReturns a string (either a new string or the given +out_string+) ;TI" containing the bytes read. ;TI"JThe encoding of the string depends on both +maxLen+ and +out_string+:;T@o; ; ;;[o;;0; [o; ; [I"9+maxlen+ is +nil+: uses internal encoding of +self+ ;TI"4(regardless of whether +out_string+ was given).;To;;0; [o; ; [I"+maxlen+ not +nil+:;T@o; ; ;;[o;;0; [o; ; [I"?+out_string+ given: encoding of +out_string+ not modified.;To;;0; [o; ; [I"0+out_string+ not given: ASCII-8BIT is used.;T@o; ; [I")Without Argument +out_string+;T@o; ; [I",When argument +out_string+ is omitted, ;TI"(the returned value is a new string:;T@o:RDoc::Markup::Verbatim; [ I"f = File.new('t.txt') ;TI" f.read ;TI"S# => "This is line one.\nThis is the second line.\nThis is the third line.\n" ;TI"f.rewind ;TI"Gf.read(40) # => "This is line one.\r\nThis is the second li" ;TI"?f.read(40) # => "ne.\r\nThis is the third line.\r\n" ;TI"f.read(40) # => nil ;T: @format0o; ; [I"2If +maxlen+ is zero, returns an empty string.;T@o; ; [I"' With Argument +out_string+;T@o; ; [I"*When argument +out_string+ is given, ;TI"Cthe returned value is +out_string+, whose content is replaced:;T@o;; [I"f = File.new('t.txt') ;TI"s = 'foo' # => "foo" ;TI"bf.read(nil, s) # => "This is line one.\nThis is the second line.\nThis is the third line.\n" ;TI"bs # => "This is line one.\nThis is the second line.\nThis is the third line.\n" ;TI"f.rewind ;TI"s = 'bar' ;TI"Ff.read(40, s) # => "This is line one.\r\nThis is the second li" ;TI"Fs # => "This is line one.\r\nThis is the second li" ;TI"s = 'baz' ;TI">f.read(40, s) # => "ne.\r\nThis is the third line.\r\n" ;TI">s # => "ne.\r\nThis is the third line.\r\n" ;TI"s = 'bat' ;TI"f.read(40, s) # => nil ;TI"s # => "" ;T;0o; ; [I"CNote that this method behaves like the fread() function in C. ;TI"GThis means it retries to invoke read(2) system calls to read data ;TI".with the specified maxlen (or until EOF).;T@o; ; [I"LThis behavior is preserved even if the stream is in non-blocking mode. ;TI"E(This method is non-blocking-flag insensitive as other methods.);T@o; ; [I"AIf you need the behavior like a single read(2) system call, ;TI"9consider #readpartial, #read_nonblock, and #sysread.;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"iread(maxlen = nil) -> string or nil read(maxlen = nil, out_string) -> out_string or nil ;T0[I"(p1 = v1, p2 = v2);T@uFI"IO;TcRDoc::NormalClass00