HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/ri/3.0.0/system/IO/readpartial-i.ri
U:RDoc::AnyMethod[iI"readpartial:ETI"IO#readpartial;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[I"<Reads at most <i>maxlen</i> bytes from the I/O stream. ;TI"GIt blocks only if <em>ios</em> has no data immediately available. ;TI"-It doesn't block if some data available.;To:RDoc::Markup::BlankLineo;
;	[	I"3If the optional _outbuf_ argument is present, ;TI">it must reference a String, which will receive the data. ;TI"LThe _outbuf_ will contain only the received data after the method call ;TI".even if it is not empty at the beginning.;T@o;
;	[I"'It raises EOFError on end of file.;T@o;
;	[I"Ireadpartial is designed for streams such as pipe, socket, tty, etc. ;TI"8It blocks only when no data immediately available. ;TI"GThis means that it blocks only when following all conditions hold.;To:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;	[o;
;	[I"/the byte buffer in the IO object is empty.;To;;0;	[o;
;	[I"(the content of the stream is empty.;To;;0;	[o;
;	[I"&the stream is not reached to EOF.;T@o;
;	[I"BWhen readpartial blocks, it waits data or EOF on the stream. ;TI"AIf some data is reached, readpartial returns with the data. ;TI"4If EOF is reached, readpartial raises EOFError.;T@o;
;	[
I"HWhen readpartial doesn't blocks, it returns or raises immediately. ;TI"IIf the byte buffer is not empty, it returns the data in the buffer. ;TI"/Otherwise if the stream has some content, ;TI"(it returns the data in the stream. ;TI"COtherwise if the stream is reached to EOF, it raises EOFError.;T@o:RDoc::Markup::Verbatim;	[I"Kr, w = IO.pipe           #               buffer          pipe content
;TI"Ew << "abc"               #               ""              "abc".
;TI"Ar.readpartial(4096)      #=> "abc"       ""              ""
;TI"Ir.readpartial(4096)      # blocks because buffer and pipe is empty.
;TI"
;TI"Kr, w = IO.pipe           #               buffer          pipe content
;TI"Dw << "abc"               #               ""              "abc"
;TI"Hw.close                  #               ""              "abc" EOF
;TI"Br.readpartial(4096)      #=> "abc"       ""              EOF
;TI"0r.readpartial(4096)      # raises EOFError
;TI"
;TI"Kr, w = IO.pipe           #               buffer          pipe content
;TI"Kw << "abc\ndef\n"        #               ""              "abc\ndef\n"
;TI"Ar.gets                   #=> "abc\n"     "def\n"         ""
;TI"Fw << "ghi\n"             #               "def\n"         "ghi\n"
;TI"Fr.readpartial(4096)      #=> "def\n"     ""              "ghi\n"
;TI"Ar.readpartial(4096)      #=> "ghi\n"     ""              ""
;T:@format0o;
;	[I"7Note that readpartial behaves similar to sysread. ;TI"The differences are:;To;;
;;[o;;0;	[o;
;	[I"@If the byte buffer is not empty, read from the byte buffer ;TI"4instead of "sysread for buffered IO (IOError)".;To;;0;	[o;
;	[I"AIt doesn't cause Errno::EWOULDBLOCK and Errno::EINTR.  When ;TI"Breadpartial meets EWOULDBLOCK and EINTR by read system call, ;TI"'readpartial retry the system call.;T@o;
;	[I"HThe latter means that readpartial is nonblocking-flag insensitive. ;TI"HIt blocks on the situation IO#sysread causes Errno::EWOULDBLOCK as ;TI" if the fd is blocking mode.;T:
@fileI"	io.c;T:0@omit_headings_from_table_of_contents_below0I"cios.readpartial(maxlen)              -> string
ios.readpartial(maxlen, outbuf)      -> outbuf
;T0[I"(*args);T@gFI"IO;TcRDoc::NormalClass00