るりまサーチ

最速Rubyリファレンスマニュアル検索!
154件ヒット [1-100件を表示] (0.043秒)

別のキーワード

  1. rexml/document write
  2. _builtin write
  3. io write
  4. tuple write
  5. stringio write

キーワード

検索結果

<< 1 2 > >>

IO#close -> nil (18153.0)

入出力ポートをクローズします。

...例外 IOError が発生しま
す。ガーベージコレクトの際にはクローズされていない IO ポートはクロー
ズされます。
self がパイプでプロセスにつながっていれば、そのプロセスの終
了を待ち合わせます。


@raise Errno::EXXX close...
...e 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_write...
...うと例外 IOError が発生しま
す。ガーベージコレクトの際にはクローズされていない IO ポートはクロー
ズされます。
self がパイプでプロセスにつながっていれば、そのプロセスの終
了を待ち合わせます。

既に 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_write -> nil (12258.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 (6158.0)

self が完全に(読み込み用と書き込み用の両方が)クローズされている場合に true を返します。 そうでない場合は false を返します。

...例][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#close_read -> nil (6157.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#reopen(path) -> self (23.0)

path で指定されたファイルにストリームを繋ぎ換えます。

...ます。
IO
#pos, IO#lineno などはリセットされます。

@param path パスを表す文字列を指定します。

@param mode パスを開く際のモードを文字列で指定します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO
.write("testfil...
...int("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}

@see Kernel.#open...

絞り込み条件を変える

IO#reopen(path, mode) -> self (23.0)

path で指定されたファイルにストリームを繋ぎ換えます。

...ます。
IO
#pos, IO#lineno などはリセットされます。

@param path パスを表す文字列を指定します。

@param mode パスを開く際のモードを文字列で指定します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO
.write("testfil...
...int("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}

@see Kernel.#open...

IO#clone -> IO (22.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#dup -> IO (22.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#fcntl(cmd, arg = 0) -> Integer (16.0)

IOに対してシステムコール fcntl を実行します。 機能の詳細は fcntl(2) を参照してください。 fcntl(2) が返した整数を返します。

...
IO
に対してシステムコール fcntl を実行します。
機能の詳細は fcntl(2) を参照してください。
fcntl(2) が返した整数を返します。

@param cmd IO に対するコマンドを、添付ライブラリ fcntl が提供している定数で指定します。

@param...
...す。

@raise Errno::EXXX fcntl の実行に失敗した場合に発生します。

@raise IOError 既に close されている場合に発生します。

//emlist[例][ruby]{
require "fcntl"

IO
.write("testfile", "abcde")
# ファイル状態フラグを読み出す
File.open("testfile") do |f|...

IO#pos -> Integer (16.0)

ファイルポインタの現在の位置を整数で返します。

...ファイルポインタの現在の位置を整数で返します。

@raise IOError 既に close されている場合に発生します。

//emlist[例][ruby]{
IO
.write("testfile", "This is line one\n")
File.open("testfile") do |f|
f.pos # => 0
f.gets # => "This is line one\n"
f.pos...

絞り込み条件を変える

<< 1 2 > >>