ungetbyte

ios.ungetbyte(string) â nil
ios.ungetbyte(integer) â nil
Instance Public methods

Pushes back bytes (passed as a parameter) onto ios, such that a subsequent buffered read will return it. Only one byte may be pushed back before a subsequent read operation (that is, you will be able to read only the last of several bytes that have been pushed back). Has no effect with unbuffered reads (such as IO#sysread).

f = File.new("testfile")   #=> #<File:testfile>
b = f.getbyte              #=> 0x38
f.ungetbyte(b)             #=> nil
f.getbyte                  #=> 0x38
doc_ruby_on_rails
2015-04-13 15:00:04
Comments
Leave a Comment

Please login to continue.