種類
- 特異メソッド (408)
- インスタンスメソッド (370)
ライブラリ
- ビルトイン (730)
-
io
/ console (12) -
io
/ wait (36)
キーワード
- binread (12)
- clone (12)
- close (12)
-
close
_ read (12) -
close
_ write (12) - closed? (12)
-
copy
_ stream (24) - dup (12)
- fdatasync (12)
- flush (12)
- getc (12)
- nread (12)
- pipe (96)
- popen (168)
- pread (8)
- pwrite (8)
- raw (12)
-
read
_ nonblock (12) - readbyte (12)
- readchar (12)
- readline (36)
- readlines (72)
- readpartial (12)
- ready? (12)
- select (12)
-
set
_ encoding _ by _ bom (6) - sysread (12)
- sysseek (12)
- syswrite (12)
- ungetc (12)
-
wait
_ readable (12) - write (36)
検索結果
先頭5件
-
IO
# readchar -> String (6107.0) -
IO ポートから 1 文字読み込んで返します。 EOF に到達した時には EOFError が発生します。
...
IO ポートから 1 文字読み込んで返します。
EOF に到達した時には EOFError が発生します。
テキスト読み込みメソッドとして動作します。
IO#getc との違いは EOF での振る舞いのみです。
@raise EOFError EOF に到達した時に発生し......す。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("testfile")
p f.readchar #=> "い"
p f.readchar #=> "ろ"
p f.readchar #=> "は"
f.read
f.readchar......#=> EOFError
@see IO#getc... -
IO
. binread(path , length = nil , offset = 0) -> String | nil (6107.0) -
path で指定したファイルを open し、offset の所まで seek し、 length バイト読み込みます。
...例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...\n")
IO.binread("testfile") # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
IO.binread("testfile", 20) # => "This is line one\nThi"
IO.binread("testfile......", 20, 10) # => "ne one\nThis is line "
//}
@see IO.read... -
IO
# nread -> Integer (6101.0) -
ブロックせずに読み込み可能なバイト数を返します。 ブロックする場合は0を返します。
ブロックせずに読み込み可能なバイト数を返します。
ブロックする場合は0を返します。
判別が不可能な場合は0を返します。 -
IO
# readbyte -> Integer (6101.0) -
IO から1バイトを読み込み整数として返します。 既に EOF に達していれば EOFError が発生します。
...
IO から1バイトを読み込み整数として返します。
既に EOF に達していれば EOFError が発生します。
@raise EOFError 既に EOF に達している場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "123")
File.open("testfile") do |f|
begin
f.rea......dbyte # => 49
f.readbyte # => 50
f.readbyte # => 51
f.readbyte # => 例外発生
rescue => e
e.class # => EOFError
end
end
//}... -
IO
# readline(limit) -> String (6101.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。
...が発生します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。
limit で最大読み込みバイト数を指定します。ただしマルチバイト......生します。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline......#=> EOFError
$_ #=> nil
@see $/, IO#gets... -
IO
# readline(limit , chomp: false) -> String (6101.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。
...が発生します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。
limit で最大読み込みバイト数を指定します。ただしマルチバイト......生します。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline......#=> EOFError
$_ #=> nil
@see $/, IO#gets... -
IO
# readline(rs = $ / ) -> String (6101.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。
...が発生します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。
limit で最大読み込みバイト数を指定します。ただしマルチバイト......生します。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline......#=> EOFError
$_ #=> nil
@see $/, IO#gets... -
IO
# readline(rs = $ / , chomp: false) -> String (6101.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。
...が発生します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。
limit で最大読み込みバイト数を指定します。ただしマルチバイト......生します。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline......#=> EOFError
$_ #=> nil
@see $/, IO#gets... -
IO
# readline(rs , limit) -> String (6101.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。
...が発生します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。
limit で最大読み込みバイト数を指定します。ただしマルチバイト......生します。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline......#=> EOFError
$_ #=> nil
@see $/, IO#gets... -
IO
# readline(rs , limit , chomp: false) -> String (6101.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。
...が発生します。
テキスト読み込みメソッドとして動作します。
読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。
limit で最大読み込みバイト数を指定します。ただしマルチバイト......生します。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline......#=> EOFError
$_ #=> nil
@see $/, IO#gets... -
IO
# readlines(limit) -> [String] (6101.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File.open("testfile") { |f| p f.readlines......(3) } # => ["lin", "e1,", "\n", "lin", "e2,", "\n", "lin", "e3,", "\n"]
File.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}
@see $/, IO#gets... -
IO
# readlines(limit , chomp: false) -> [String] (6101.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File.open("testfile") { |f| p f.readlines......e3,", "\n"]
File.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}
//emlist[例: rsを取り除く(chomp = true)][ruby]{
IO.write("testfile", "line1,\rline2,\r\nline3,\n")
File.open("testfile") { |f| p f.readlines(chomp: true) } # => ["line1,\rl......ine2,", "line3,"]
File.open("testfile") { |f| p f.readlines("\r", chomp: true) } # => ["line1,", "line2,", "\nline3,\n"]
//}
@see $/, IO#gets... -
IO
# readlines(rs = $ / ) -> [String] (6101.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File.open("testfile") { |f| p f.readlines......(3) } # => ["lin", "e1,", "\n", "lin", "e2,", "\n", "lin", "e3,", "\n"]
File.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}
@see $/, IO#gets... -
IO
# readlines(rs = $ / , chomp: false) -> [String] (6101.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "line1,\nline2,\nline3,\n")
File.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File.open("testfile") { |f| p f.readlines......e3,", "\n"]
File.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}
//emlist[例: rsを取り除く(chomp = true)][ruby]{
IO.write("testfile", "line1,\rline2,\r\nline3,\n")
File.open("testfile") { |f| p f.readlines(chomp: true) } # => ["line1,\rl......ine2,", "line3,"]
File.open("testfile") { |f| p f.readlines("\r", chomp: true) } # => ["line1,", "line2,", "\nline3,\n"]
//}
@see $/, IO#gets...