別のキーワード
クラス
- CSV (48)
- File (12)
- IO (226)
- Method (14)
- Module (12)
-
Net
:: HTTP (48) -
Net
:: HTTPResponse (24) - Object (12)
- OptionParser (12)
- Proc (14)
-
Rake
:: FileList (96) -
Rake
:: FileTask (12) -
Rake
:: PackageTask (24) -
Zlib
:: GzipWriter (24)
モジュール
-
Rake
:: TaskManager (12)
キーワード
- << (26)
- >> (14)
-
add
_ row (12) -
attr
_ writer (12) - clone (12)
- close (12)
-
close
_ read (12) -
close
_ write (12) - display (12)
- dup (12)
-
each
_ byte (24) -
each
_ codepoint (24) - egrep (12)
-
excluded
_ from _ list? (12) - existing (12)
- existing! (12)
- ext (12)
- fcntl (12)
- finish (12)
- get (24)
- gsub! (12)
- import (12)
-
internal
_ encoding (12) - load (12)
- needed? (12)
-
package
_ files (12) -
package
_ files= (12) - pos (12)
- pos= (12)
- post (24)
- pread (8)
- puts (12)
- pwrite (8)
-
read
_ body (24) - readbyte (12)
- resolve (12)
-
set
_ encoding _ by _ bom (6) - stat (12)
-
synthesize
_ file _ task (12) - syswrite (12)
- tell (12)
- truncate (12)
-
write
_ headers? (12)
検索結果
先頭5件
-
IO
# dup -> IO (25.0) -
レシーバと同じ IO を参照する新しい IO オブジェクトを返します。 参照しているファイル記述子は dup(2) されます。
...しいフリーズされていない 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 _ byte -> Enumerator (25.0) -
IO の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。
...み込みメソッドとして動作します。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "aあ")
File.open("testfile") do |io|
io.each_byte { |x| p x }
# => 97
# 227
# 129
# 130
end
//}... -
IO
# each _ byte {|ch| . . . } -> self (25.0) -
IO の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。
...み込みメソッドとして動作します。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
//emlist[例][ruby]{
IO.write("testfile", "aあ")
File.open("testfile") do |io|
io.each_byte { |x| p x }
# => 97
# 227
# 129
# 130
end
//}... -
IO
# each _ codepoint -> Enumerator (25.0) -
IO の各コードポイントに対して繰り返しブロックを呼びだします。
...にはコードポイントを表す整数が渡されます。
ブロックを省略した場合には、Enumerator を返します。
//emlist[例][ruby]{
IO.write("testfile", "abcdeあ")
File.open("testfile") do |f|
f.each_codepoint { |i| p i }
end
# => 97
# 98
# 99
# 100
# 101
# 12354
//}... -
IO
# each _ codepoint {|c| . . . } -> self (25.0) -
IO の各コードポイントに対して繰り返しブロックを呼びだします。
...にはコードポイントを表す整数が渡されます。
ブロックを省略した場合には、Enumerator を返します。
//emlist[例][ruby]{
IO.write("testfile", "abcdeあ")
File.open("testfile") do |f|
f.each_codepoint { |i| p i }
end
# => 97
# 98
# 99
# 100
# 101
# 12354
//}... -
IO
# fcntl(cmd , arg = 0) -> Integer (25.0) -
IOに対してシステムコール fcntl を実行します。 機能の詳細は fcntl(2) を参照してください。 fcntl(2) が返した整数を返します。
...に発生します。
//emlist[例][ruby]{
require "fcntl"
IO.write("testfile", "abcde")
# ファイル状態フラグを読み出す
File.open("testfile") do |f|
f.fcntl(Fcntl::F_GETFL, 0) # => 0
f.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) # => 0
f.fcntl(Fcntl::F_GETFL, 0) # => 4
end
//}... -
IO
# internal _ encoding -> Encoding | nil (25.0) -
IO の内部エンコーディングを返します。 内部エンコーディングが指定されていない場合は nil を返します。
...エンコーディングが指定されていない場合は nil を返します。
//emlist[例][ruby]{
IO.write("testfile", "abcde")
File.open("testfile") do |f|
p f.internal_encoding # => nil
f.set_encoding("ASCII-8BIT", "EUC-JP")
p f.internal_encoding # => #<Encoding:EUC-JP>
end
//}... -
IO
# pos -> Integer (25.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 # => 17
end
//}... -
IO
# pos=(n) (25.0) -
ファイルポインタを指定位置に移動します。 IO#seek(n, IO::SEEK_SET) と同じです。
...ットを整数で指定します。
@raise IOError 既に close されている場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\n")
File.open("testfile") do |f|
f.pos # => 0
f.pos = 17
f.gets # => "This is line two\n"
end
//}... -
IO
# pread(maxlen , offset , outbuf = "") -> string (25.0) -
preadシステムコールを使ってファイルポインタを変更せずに、また現在のファイルポインタに 依存せずにmaxlenバイト読み込みます。
...ない OS で発生します。
//emlist[例][ruby]{
File.write("testfile", "This is line one\nThis is line two\n")
File.open("testfile") do |f|
p f.read # => "This is line one\nThis is line two\n"
p f.pread(12, 0) # => "This is line"
p f.pread(9, 8) # => "line one\n"
end
//}...