PATH:
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
IO
U:RDoc::AnyMethod[iI"readpartial:ETI"IO#readpartial;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"1Reads up to +maxlen+ bytes from the stream; ;TI"Greturns a string (either a new string or the given +out_string+). ;TI"Its encoding is:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List: @type:BULLET:@items[ o:RDoc::Markup::ListItem:@label0; [o; ; [I"FThe unchanged encoding of +out_string+, if +out_string+ is given.;To;;0; [o; ; [I"ASCII-8BIT, otherwise.;T@o;;0; [o; ; [I";Contains +maxlen+ bytes from the stream, if available.;To;;0; [o; ; [I">Otherwise contains all available bytes, if any available.;To;;0; [o; ; [I""Otherwise is an empty string.;T@o; ; [I"CWith the single non-negative integer argument +maxlen+ given, ;TI"returns a new string:;T@o:RDoc::Markup::Verbatim; [I"f = File.new('t.txt') ;TI"3f.readpartial(20) # => "First line\nSecond l" ;TI"3f.readpartial(20) # => "ine\n\nFourth line\n" ;TI"+f.readpartial(20) # => "Fifth line\n" ;TI"*f.readpartial(20) # Raises EOFError. ;TI" f.close ;T:@format0o; ; [I"IWith both argument +maxlen+ and string argument +out_string+ given, ;TI"#returns modified +out_string+:;T@o;; [I"f = File.new('t.txt') ;TI"s = 'foo' ;TI"6f.readpartial(20, s) # => "First line\nSecond l" ;TI"s = 'bar' ;TI""f.readpartial(0, s) # => "" ;TI" f.close ;T;0o; ; [I"LThis method is useful for a stream such as a pipe, a socket, or a tty. ;TI";It blocks only when no data is immediately available. ;TI"IThis means that it blocks only when _all_ of the following are true:;T@o;; ;;[o;;0; [o; ; [I",The byte buffer in the stream is empty.;To;;0; [o; ; [I"(The content of the stream is empty.;To;;0; [o; ; [I"The stream is not at EOF.;T@o; ; [I"NWhen blocked, the method waits for either more data or EOF on the stream:;T@o;; ;;[o;;0; [o; ; [I"7If more data is read, the method returns the data.;To;;0; [o; ; [I"3If EOF is reached, the method raises EOFError.;T@o; ; [I"7When not blocked, the method responds immediately:;T@o;; ;;[o;;0; [o; ; [I"2Returns data from the buffer if there is any.;To;;0; [o; ; [I"<Otherwise returns data from the stream if there is any.;To;;0; [o; ; [I"=Otherwise raises EOFError if the stream has reached EOF.;T@o; ; [I"FNote that this method is similar to sysread. The differences are:;T@o;; ;;[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 retries the system call.;T@o; ; [I"IThe latter means that readpartial is non-blocking-flag insensitive. ;TI"HIt blocks on the situation IO#sysread causes Errno::EWOULDBLOCK as ;TI" if the fd is blocking mode.;T@o; ; [I"Examples:;T@o;; [I"M# # Returned Buffer Content Pipe Content ;TI" r, w = IO.pipe # ;TI"Gw << 'abc' # "" "abc". ;TI"Cr.readpartial(4096) # => "abc" "" "" ;TI"Lr.readpartial(4096) # (Blocks because buffer and pipe are empty.) ;TI" ;TI"M# # Returned Buffer Content Pipe Content ;TI" r, w = IO.pipe # ;TI"Fw << 'abc' # "" "abc" ;TI"Jw.close # "" "abc" EOF ;TI"Er.readpartial(4096) # => "abc" "" EOF ;TI"0r.readpartial(4096) # raises EOFError ;TI" ;TI"M# # Returned Buffer Content Pipe Content ;TI" r, w = IO.pipe # ;TI"Mw << "abc\ndef\n" # "" "abc\ndef\n" ;TI"Cr.gets # => "abc\n" "def\n" "" ;TI"Hw << "ghi\n" # "def\n" "ghi\n" ;TI"Hr.readpartial(4096) # => "def\n" "" "ghi\n" ;TI"Br.readpartial(4096) # => "ghi\n" "" "";T;0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"]readpartial(maxlen) -> string readpartial(maxlen, out_string) -> out_string ;T0[ I"(*args);T@�FI"IO;TcRDoc::NormalClass00
[+]
..
[-] raw-i.ri
[edit]
[-] each_byte-i.ri
[edit]
[-] echo%3f-i.ri
[edit]
[-] nonblock-i.ri
[edit]
[-] scroll_forward-i.ri
[edit]
[-] copy_stream-c.ri
[edit]
[-] goto-i.ri
[edit]
[-] erase_line-i.ri
[edit]
[-] readchar-i.ri
[edit]
[+]
EINPROGRESSWaitReadable
[-] write-c.ri
[edit]
[-] getch-i.ri
[edit]
[-] isatty-i.ri
[edit]
[-] readlines-i.ri
[edit]
[-] ioctl-i.ri
[edit]
[-] sysseek-i.ri
[edit]
[-] try_convert-c.ri
[edit]
[+]
EINPROGRESSWaitWritable
[-] readlines-c.ri
[edit]
[-] oflush-i.ri
[edit]
[-] %3c%3c-i.ri
[edit]
[-] binwrite-c.ri
[edit]
[-] eof-i.ri
[edit]
[-] ungetc-i.ri
[edit]
[-] ttyname-i.ri
[edit]
[+]
generic_readable
[-] pwrite-i.ri
[edit]
[-] console_mode-i.ri
[edit]
[-] winsize-i.ri
[edit]
[-] nonblock%3d-i.ri
[edit]
[-] set_encoding_by_bom-i.ri
[edit]
[-] closed%3f-i.ri
[edit]
[-] wait_readable-i.ri
[edit]
[+]
Buffer
[-] sync%3d-i.ri
[edit]
[-] sysread-i.ri
[edit]
[-] each_line-i.ri
[edit]
[-] echo%3d-i.ri
[edit]
[-] raw%21-i.ri
[edit]
[-] cdesc-IO.ri
[edit]
[-] read_nonblock-i.ri
[edit]
[-] rewind-i.ri
[edit]
[-] binmode%3f-i.ri
[edit]
[-] close_on_exec%3f-i.ri
[edit]
[-] write_nonblock-i.ri
[edit]
[+]
generic_writable
[-] expect-i.ri
[edit]
[-] flush-i.ri
[edit]
[-] lineno-i.ri
[edit]
[-] stat-i.ri
[edit]
[-] new-c.ri
[edit]
[-] printf-i.ri
[edit]
[-] cursor_up-i.ri
[edit]
[-] autoclose%3f-i.ri
[edit]
[-] cooked%21-i.ri
[edit]
[-] wait-i.ri
[edit]
[-] getc-i.ri
[edit]
[-] clear_screen-i.ri
[edit]
[-] external_encoding-i.ri
[edit]
[-] readpartial-i.ri
[edit]
[-] seek-i.ri
[edit]
[-] close_read-i.ri
[edit]
[-] getpass-i.ri
[edit]
[-] nread-i.ri
[edit]
[-] tty%3f-i.ri
[edit]
[-] pipe-c.ri
[edit]
[-] read-c.ri
[edit]
[-] sync-i.ri
[edit]
[-] cooked-i.ri
[edit]
[-] erase_screen-i.ri
[edit]
[-] putc-i.ri
[edit]
[+]
ConsoleMode
[-] to_path-i.ri
[edit]
[-] set_encoding-i.ri
[edit]
[-] cursor%3d-i.ri
[edit]
[-] lineno%3d-i.ri
[edit]
[-] close-i.ri
[edit]
[-] select-c.ri
[edit]
[+]
EAGAINWaitWritable
[-] each-i.ri
[edit]
[-] fcntl-i.ri
[edit]
[-] pos-i.ri
[edit]
[-] open-c.ri
[edit]
[-] reopen-i.ri
[edit]
[+]
TimeoutError
[+]
EWOULDBLOCKWaitWritable
[-] readline-i.ri
[edit]
[-] pid-i.ri
[edit]
[-] cursor_right-i.ri
[edit]
[-] wait_writable-i.ri
[edit]
[-] path-i.ri
[edit]
[-] nonblock%3f-i.ri
[edit]
[-] readbyte-i.ri
[edit]
[-] binmode-i.ri
[edit]
[-] ioflush-i.ri
[edit]
[-] puts-i.ri
[edit]
[-] getbyte-i.ri
[edit]
[-] close_on_exec%3d-i.ri
[edit]
[-] each_char-i.ri
[edit]
[-] wait_priority-i.ri
[edit]
[-] goto_column-i.ri
[edit]
[-] to_i-i.ri
[edit]
[-] check_winsize_changed-i.ri
[edit]
[+]
WaitReadable
[-] fsync-i.ri
[edit]
[-] cursor_down-i.ri
[edit]
[-] pos%3d-i.ri
[edit]
[-] pread-i.ri
[edit]
[-] each_codepoint-i.ri
[edit]
[-] pressed%3f-i.ri
[edit]
[-] timeout%3d-i.ri
[edit]
[-] syswrite-i.ri
[edit]
[-] timeout-i.ri
[edit]
[-] gets-i.ri
[edit]
[-] cursor-i.ri
[edit]
[-] ungetbyte-i.ri
[edit]
[-] for_fd-c.ri
[edit]
[-] ready%3f-i.ri
[edit]
[-] winsize%3d-i.ri
[edit]
[-] internal_encoding-i.ri
[edit]
[-] fdatasync-i.ri
[edit]
[-] iflush-i.ri
[edit]
[-] popen-c.ri
[edit]
[-] binread-c.ri
[edit]
[-] read-i.ri
[edit]
[-] sysopen-c.ri
[edit]
[-] beep-i.ri
[edit]
[-] advise-i.ri
[edit]
[-] scroll_backward-i.ri
[edit]
[-] pathconf-i.ri
[edit]
[-] write-i.ri
[edit]
[-] console_mode%3d-i.ri
[edit]
[-] autoclose%3d-i.ri
[edit]
[-] inspect-i.ri
[edit]
[+]
WaitWritable
[-] close_write-i.ri
[edit]
[-] tell-i.ri
[edit]
[-] fileno-i.ri
[edit]
[-] cursor_left-i.ri
[edit]
[+]
EWOULDBLOCKWaitReadable
[-] print-i.ri
[edit]
[-] foreach-c.ri
[edit]
[-] eof%3f-i.ri
[edit]
[-] console-c.ri
[edit]
[-] to_io-i.ri
[edit]
[-] noecho-i.ri
[edit]
[+]
EAGAINWaitReadable