キーワード
- << (11)
- advise (11)
- autoclose= (11)
- autoclose? (11)
- binmode (11)
- binmode? (11)
- bytes (14)
- chars (14)
- clone (11)
- close (11)
-
close
_ on _ exec= (11) -
close
_ on _ exec? (11) -
close
_ read (11) -
close
_ write (11) - closed? (11)
- codepoints (14)
- dup (11)
- each (66)
-
each
_ byte (22) -
each
_ char (22) -
each
_ codepoint (22) -
each
_ line (66) - eof (11)
- eof? (11)
-
external
_ encoding (11) - fcntl (11)
- fdatasync (11)
- fileno (11)
- flush (11)
- fsync (11)
- getbyte (11)
- getc (11)
- gets (33)
-
internal
_ encoding (11) - ioctl (11)
- isatty (11)
- lineno (11)
- lineno= (11)
- lines (42)
- path (2)
- pid (11)
- pos (11)
- pos= (11)
- pread (7)
- print (11)
- printf (11)
- putc (11)
- puts (11)
- pwrite (7)
- read (11)
-
read
_ nonblock (11) - readbyte (11)
- readchar (11)
- readline (33)
- readlines (33)
- readpartial (11)
- reopen (33)
- rewind (11)
- seek (11)
-
set
_ encoding (33) -
set
_ encoding _ by _ bom (5) - stat (11)
- sync (11)
- sync= (11)
- sysread (11)
- sysseek (11)
- syswrite (11)
- tell (11)
-
to
_ i (11) -
to
_ io (11) -
to
_ path (2) - tty? (11)
- ungetbyte (11)
- ungetc (11)
- write (11)
-
write
_ nonblock (11)
検索結果
先頭5件
-
IO
# clone -> IO (4.0) -
レシーバと同じ IO を参照する新しい IO オブジェクトを返します。 参照しているファイル記述子は dup(2) されます。
...シーバと同じ IO を参照する新しい IO オブジェクトを返します。
参照しているファイル記述子は dup(2) されます。
clone の際に self は一旦 IO#flush されます。
フリーズした IO の clone は同様にフリーズされた IO を返しますが、......しいフリーズされていない IO を返します。
@raise IOError 既に close されていた場合に発生します。
//emlist[例][ruby]{
clone_io = nil
IO.write("testfile", "test")
File.open("testfile") do |io|
clone_io = io.clone
end
clone_io.read # => "test"
clone_io.close
//}... -
IO
# close -> nil (4.0) -
入出力ポートをクローズします。
...ポートをクローズします。
以後このポートに対して入出力を行うと例外 IOError が発生しま
す。ガーベージコレクトの際にはクローズされていない IO ポートはクロー
ズされます。
self がパイプでプロセスにつながっていれ......@raise IOError 既に close されていた場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "test")
f = File.open("testfile")
f.read # => "test"
f.close
# f.read # => IOError (すでに close しているので read できない)
//}
@see IO#closed?, IO#close_read, IO#close......se Errno::EXXX close に失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "test")
f = File.open("testfile")
f.read # => "test"
f.close
# f.read # => IOError (すでに close しているので read できない)
//}
@see IO#closed?, IO#close_read, IO#close_write... -
IO
# close _ on _ exec=(bool) (4.0) -
自身に close-on-exec フラグを設定します。
...2)
@param bool 自身の close-on-exec フラグを true か false で指定します。
f = open("/dev/null")
f.close_on_exec = true
system("cat", "/proc/self/fd/#{f.fileno}") # cat: /proc/self/fd/3: No such file or directory
f.closed? #=> false
@see IO#close_on_exec?... -
IO
# close _ on _ exec? -> bool (4.0) -
自身に close-on-exec フラグが設定されていた場合 true を返します。 そうでない場合に false を返します。
...ます。
そうでない場合に false を返します。
f = open("/dev/null")
f.close_on_exec? #=> true
f.close_on_exec = false
f.close_on_exec? #=> false
f.close_on_exec = true
f.close_on_exec? #=> true
@see IO#close_on_exec=... -
IO
# close _ read -> nil (4.0) -
読み込み用の IO を close します。主にパイプや読み書き両用に作成し た IO オブジェクトで使用します。
...読み込み用の IO を close します。主にパイプや読み書き両用に作成し
た IO オブジェクトで使用します。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
@raise Errno::EXXX close に失敗した場合に発生し......ます。
//emlist[例][ruby]{
IO.popen("/bin/sh","r+") do |f|
f.close_read
# f.readlines # => IOError: not opened for reading
end
//}
@see IO#close, IO#closed?, IO#close_write......読み込み用の IO を close します。主にパイプや読み書き両用に作成し
た IO オブジェクトで使用します。
既に close されていた場合には単に無視されます。
@raise IOError 自身が読み込み用にオープンされていなければ発生し......ます。
@raise Errno::EXXX close に失敗した場合に発生します。
//emlist[例][ruby]{
IO.popen("/bin/sh","r+") do |f|
f.close_read
# f.readlines # => IOError: not opened for reading
end
//}
@see IO#close, IO#closed?, IO#close_write... -
IO
# close _ write -> nil (4.0) -
書き込み用の IO を close します。
... IO を close します。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX close に失敗した場合に発生します。
//emlist[例][ruby]{
f = IO.popen("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOEr......ror: not opened for writing
end
//}
@see IO#close, IO#closed?, IO#close_read......の IO を close します。
既に close されていた場合には単に無視されます。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX close に失敗した場合に発生します。
//emlist[例][ruby]{
f = IO.popen......("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOError: not opened for writing
end
//}
@see IO#close, IO#closed?, IO#close_read... -
IO
# closed? -> bool (4.0) -
self が完全に(読み込み用と書き込み用の両方が)クローズされている場合に true を返します。 そうでない場合は false を返します。
...t[例][ruby]{
IO.write("testfile", "test")
f = File.new("testfile")
f.close # => nil
f.closed? # => true
f = IO.popen("/bin/sh","r+")
f.close_write # => nil
f.closed? # => false
f.close_read # => nil
f.closed? # => true
//}
@see IO#close, IO#close_read, IO#close_write... -
IO
# codepoints -> Enumerator (4.0) -
このメソッドは obsolete です。 代わりに IO#each_codepoint を使用してください。
...このメソッドは obsolete です。
代わりに IO#each_codepoint を使用してください。
使用すると警告メッセージが表示されます。
IO の各コードポイントに対して繰り返しブロックを呼びだします。
ブロックの引数にはコードポ......イントを表す整数が渡されます。
ブロックを省略した場合には、Enumerator を返します。
@see IO#each_codepoint... -
IO
# codepoints {|c| . . . } -> self (4.0) -
このメソッドは obsolete です。 代わりに IO#each_codepoint を使用してください。
...このメソッドは obsolete です。
代わりに IO#each_codepoint を使用してください。
使用すると警告メッセージが表示されます。
IO の各コードポイントに対して繰り返しブロックを呼びだします。
ブロックの引数にはコードポ......イントを表す整数が渡されます。
ブロックを省略した場合には、Enumerator を返します。
@see IO#each_codepoint... -
IO
# dup -> IO (4.0) -
レシーバと同じ IO を参照する新しい IO オブジェクトを返します。 参照しているファイル記述子は dup(2) されます。
...シーバと同じ IO を参照する新しい IO オブジェクトを返します。
参照しているファイル記述子は dup(2) されます。
clone の際に self は一旦 IO#flush されます。
フリーズした IO の clone は同様にフリーズされた IO を返しますが、......しいフリーズされていない IO を返します。
@raise IOError 既に close されていた場合に発生します。
//emlist[例][ruby]{
clone_io = nil
IO.write("testfile", "test")
File.open("testfile") do |io|
clone_io = io.clone
end
clone_io.read # => "test"
clone_io.close
//}... -
IO
# each(limit) -> Enumerator (4.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソ......(パラグラフモード)。
@param limit 最大の読み込みバイト数
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so o......is is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lin... -
IO
# each(limit) {|line| . . . } -> self (4.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソ......(パラグラフモード)。
@param limit 最大の読み込みバイト数
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so o......is is line three,\n"
# "4: And so on..."
//}
//emlist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lin...