るりまサーチ

最速Rubyリファレンスマニュアル検索!
226件ヒット [101-200件を表示] (0.088秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < 1 2 3 > >>

IO#each_byte -> Enumerator (26.0)

IO の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。

...
IO
の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

バイナリ読み込みメソッドとして動...
...作します。

@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 (26.0)

IO の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。

...
IO
の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

バイナリ読み込みメソッドとして動...
...作します。

@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 (26.0)

IO の各コードポイントに対して繰り返しブロックを呼びだします。

...
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 (26.0)

IO の各コードポイントに対して繰り返しブロックを呼びだします。

...
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 (26.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|...
...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 (26.0)

IO の内部エンコーディングを返します。 内部エンコーディングが指定されていない場合は nil を返します。

...
IO
の内部エンコーディングを返します。
内部エンコーディングが指定されていない場合は 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 (26.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) (26.0)

ファイルポインタを指定位置に移動します。 IO#seek(n, IO::SEEK_SET) と同じです。

...タを指定位置に移動します。
IO
#seek(n, IO::SEEK_SET) と同じです。

@param n 先頭からのオフセットを整数で指定します。

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

//emlist[例][ruby]{
IO
.write("testfile", "This is line one\nThis is lin...
...e 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 (26.0)

preadシステムコールを使ってファイルポインタを変更せずに、また現在のファイルポインタに 依存せずにmaxlenバイト読み込みます。

...みます。

IO
#seekとIO#readの組み合わせと比べて、アトミックな操作に
なるという点が優れていて、複数スレッド/プロセスから同じIOオブジェクトを
様々な位置から読み込むことを許します。
どのユーザー空間のIO層のバッフ...
...ない 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

//}...
<< < 1 2 3 > >>