D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
IO
/
Filename :
eof-i.ri
back
Copy
U:RDoc::AnyMethod[iI"eof:ETI"IO#eof;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"OReturns +true+ if the stream is positioned at its end, +false+ otherwise; ;TI"*see {Position}[rdoc-ref:IO@Position]:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"f = File.open('t.txt') ;TI" f.eof # => false ;TI"f.seek(0, :END) # => 0 ;TI"f.eof # => true ;TI" f.close ;T:@format0o; ; [I"BRaises an exception unless the stream is opened for reading; ;TI",see {Mode}[rdoc-ref:File@Access+Modes].;T@o; ; [I"?If +self+ is a stream such as pipe or socket, this method ;TI"=blocks until the other end sends some data or closes it:;T@o;; [I"r, w = IO.pipe ;TI"%Thread.new { sleep 1; w.close } ;TI"-r.eof? # => true # After 1-second wait. ;TI" ;TI"r, w = IO.pipe ;TI"(Thread.new { sleep 1; w.puts "a" } ;TI"/r.eof? # => false # After 1-second wait. ;TI" ;TI"r, w = IO.pipe ;TI"r.eof? # blocks forever ;T; 0o; ; [I"DNote that this method reads data to the input byte buffer. So ;TI"FIO#sysread may not behave as you intend with IO#eof?, unless you ;TI"Dcall IO#rewind first (which is not available for some streams).;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"eof -> true or false ;T0[[I" eof?;T@ I"();T@0FI"IO;TcRDoc::NormalClass00