sysopen

IO.sysopen(path, [mode, [perm]]) â fixnum Class Public methods Opens the given path, returning the underlying file descriptor as a Fixnum. IO.sysopen("testfile") #=> 3

try_convert

IO.try_convert(obj) â io or nil Class Public methods Try to convert obj into an IO, using #to_io method. Returns converted IO or nil if obj cannot be converted for any reason. IO.try_convert(STDOUT) #=> STDOUT IO.try_convert("STDOUT") #=> nil require 'zlib' f = open("/tmp/zz.gz") #=> #<File:/tmp/zz.gz> z = Zlib::GzipReader.open(f) #=> #<Zlib::GzipReader:0x81d8744> IO.try_convert(z) #=> #<File:/tmp/zz.gz>

write

IO.write(name, string, [offset] ) => fixnumIO.write(name, string, [offset], open_args ) => fixnum Class Public methods Opens the file, optionally seeks to the given offset, writes string, then returns the length written. write ensures the file is closed before returning. If offset is not given, the file is truncated. Otherwise, it is not truncated. If the last argument is a hash, it specifies option for internal open(). The key would be the following. open_args: is ex

&lt;&lt;

ios Instance Public methods String OutputâWrites obj to ios. obj will be converted to a string using to_s. $stdout << "Hello " << "world!\n" produces: Hello world!

advise

ios.advise(advice, offset=0, len=0) â nil Instance Public methods Announce an intention to access data from the current file in a specific pattern. On platforms that do not support the <em>posix_fadvise(2)</em> system call, this method is a no-op. advice is one of the following symbols: * :normal - No advice to give; the default assumption for an open file. * :sequential - The data will be accessed sequentially: with lower offsets read before higher ones. * :random

autoclose=

io.autoclose = bool â true or false Instance Public methods Sets auto-close flag. f = open("/dev/null") IO.for_fd(f.fileno) # ... f.gets # may cause IOError f = open("/dev/null") IO.for_fd(f.fileno).autoclose = true # ... f.gets # won't cause IOError

autoclose?

ios.autoclose? â true or false Instance Public methods Returns true if the underlying file descriptor of ios will be closed automatically at its finalization, otherwise false.

binmode

ios.binmode â ios Instance Public methods Puts ios into binary mode. Once a stream is in binary mode, it cannot be reset to nonbinary mode. newline conversion disabled encoding conversion disabled content is treated as ASCII-8BIT

binmode?

ios.binmode? â true or false Instance Public methods Returns true if ios is binmode.

bytes

bytes() Instance Public methods This is a deprecated alias for each_byte.