D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
IO
/
Filename :
ungetbyte-i.ri
back
Copy
U:RDoc::AnyMethod[iI"ungetbyte:ETI"IO#ungetbyte;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"GPushes back ("unshifts") the given data onto the stream's buffer, ;TI"Dplacing the data so that it is next to be read; returns +nil+. ;TI"(See {Byte IO}[rdoc-ref:IO@Byte+IO].;To:RDoc::Markup::BlankLine o; ; [I"Note that:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"QCalling the method has no effect with unbuffered reads (such as IO#sysread).;To;;0; [o; ; [I"ACalling #rewind on the stream discards the pushed-back data.;T@o; ; [I"DWhen argument +integer+ is given, uses only its low-order byte:;T@o:RDoc::Markup::Verbatim; [ I" File.write('t.tmp', '012') ;TI"f = File.open('t.tmp') ;TI""f.ungetbyte(0x41) # => nil ;TI"%f.read # => "A012" ;TI"f.rewind ;TI""f.ungetbyte(0x4243) # => nil ;TI"%f.read # => "C012" ;TI" f.close ;T:@format0o; ; [I"5When argument +string+ is given, uses all bytes:;T@o;; [ I" File.write('t.tmp', '012') ;TI"f = File.open('t.tmp') ;TI""f.ungetbyte('A') # => nil ;TI"%f.read # => "A012" ;TI"f.rewind ;TI""f.ungetbyte('BCDE') # => nil ;TI"(f.read # => "BCDE012" ;TI"f.close;T;0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"9ungetbyte(integer) -> nil ungetbyte(string) -> nil ;T0[ I" (p1);T@:FI"IO;TcRDoc::NormalClass00