るりまサーチ

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

別のキーワード

  1. _builtin raise
  2. kernel raise
  3. fiber raise
  4. thread raise
  5. e2mmap raise

ライブラリ

キーワード

検索結果

StringIO#pos=(n) (6115.0)

自身の位置を n に移動します。自身が表す文字列のサイズより大きくても構いません。

...いません。

@param n 自身の位置を整数で指定します。

@raise Errno::EINVAL n がマイナスである場合に発生します。

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge", 'r+')
a.pos = 10
a << 'Z'
a.string #=> "hoge\000\000\000\000\00...

StringIO#ungetc(str_or_int) -> nil (56.0)

文字列か整数で指定された str_or_int を自身に書き戻します。 nil を返します。

...@raise IOError 自身が読み込み可能でない時に発生します。

//emlist[例][ruby]{
require "stringio"
s = StringIO.new("hoge")
s.pos = 1
s.ungetc("H")
p s.string # => "Hoge"
p s.pos # => 0

s = StringIO.new("hoge")
s.pos = 1
s.ungetc("H".ord)
p s.string # => "Hoge"
p s.pos...
...# => 0

s = StringIO.new("hoge")
s.pos = 4
s.ungetc("HOGE")
p s.string # => "hogHOGE"
p s.pos # => 3

s = StringIO.new("hoge")
s.pos = 8
s.ungetc("A")
p s.string # => "hoge\000\000\000A"
p s.pos # => 7
//}...

StringIO#seek(offset, whence = IO::SEEK_SET) -> 0 (30.0)

自身の pos を whence の位置から offset バイトだけ移動させます。

...自身の pos を whence の位置から offset バイトだけ移動させます。

@param offset 移動させたいバイト数を整数で指定します。

@param whence 以下のいずれかの定数を指定します。

* IO::SEEK_SET: ファイルの先頭から (デフォルト)
* IO:...
...:SEEK_CUR: 現在のファイルポインタから
* IO::SEEK_END: ファイルの末尾から

@raise Errno::EINVAL offset + whence がマイナスである場合に発生します。

@raise ArgumentError whence が上の SEEK_SET, SEEK_CUR, SEEK_END 以外だった場合に発生します。...

StringIO#string=(buf) (14.0)

自身が表す文字列を指定された buf に変更します。

...み書き両用になりますが、
buf がフリーズされている場合には読み取り専用になります。
pos
と lineno は 0 にセットされます。


@param buf 自身が新たに表す文字列を指定します。

@raise TypeError buf が nil の場合に発生します。...