48件ヒット
[1-48件を表示]
(0.143秒)
検索結果
先頭4件
-
StringIO
# reopen(str , mode = & # 39;r+& # 39;) -> StringIO (21310.0) -
自身が表す文字列が指定された文字列 str になります。
...str になります。
与えられた str がフリーズされている場合には、mode はデフォルトでは読み取りのみに設定されます。
ブロックを与えた場合は生成した StringIO オブジェクトを引数としてブロックを評価します。
@param str......列はバッファとして使われます。StringIO#write などによって、
str 自身も書き換えられます。
@param mode Kernel.#open 同様文字列か整数で自身のモードを指定します。
@raise Errno::EACCES str がフリーズされていて、mode が書き......込み可能に設定されている場合に発生します。
//emlist[例][ruby]{
require 'stringio'
sio = StringIO.new("hoge", 'r+')
sio.reopen('foo')
p sio.read #=> "foo"
//}... -
StringIO
# reopen(sio) -> StringIO (21210.0) -
自身が表す文字列が指定された StringIO と同じものになります。
...が表す文字列が指定された StringIO と同じものになります。
@param sio 自身が表したい StringIO を指定します。
//emlist[例][ruby]{
require 'stringio'
sio = StringIO.new("hoge", 'r+')
sio2 = StringIO.new("foo", 'r+')
sio.reopen(sio2)
p sio.read... -
IO
# reopen(path) -> self (18210.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...path で指定されたファイルにストリームを繋ぎ換えます。
第二引数を省略したとき self のモードをそのまま引き継ぎます。
IO#pos, IO#lineno などはリセットされます。
@param path パスを表す文字列を指定します。
@param mode パ......ist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testf......ile>
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 (18210.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...path で指定されたファイルにストリームを繋ぎ換えます。
第二引数を省略したとき self のモードをそのまま引き継ぎます。
IO#pos, IO#lineno などはリセットされます。
@param path パスを表す文字列を指定します。
@param mode パ......ist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testf......ile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}
@see Kernel.#open...