るりまサーチ

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

別のキーワード

  1. stringio set_encoding
  2. _builtin set_encoding
  3. tracer set_get_line_procs
  4. set new
  5. openssl set

ライブラリ

クラス

キーワード

検索結果

Pathname#write(string, offset=nil, **opts) -> Integer (18214.0)

...IO.write(self.to_s, string, offset, **opts)と同じです。

@see IO.write...

IO#pwrite(string, offset) -> Integer (6207.0)

stringをoffsetの位置にpwrite()システムコールを使って書き込みます。

...stringをoffsetの位置にpwrite()システムコールを使って書き込みます。

IO#seekとIO#writeの組み合わせと比べて、アトミックな操作に
なるという点が優れていて、複数スレッド/プロセスから同じIOオブジェクトを
様々な位置から読...
...のユーザー空間のIO層のバッファリングもバイパスします。

@param string 書き込む文字列を指定します。
@param offset ファイルポインタを変えずに書き込む位置を指定します。

@return 書き込んだバイト数を返します。

@raise Errno...
...敗した場合に発生します。
@raise NotImplementedError システムコールがサポートされていない OS で発生します。

//emlist[例][ruby]{
File.open("testfile", "w") do |f|
f.pwrite("ABCDEF", 3) # => 6
end

File.read("testfile") # => "\u0000\u0000\u0000ABCDEF"
//}...

Pathname#binwrite(string, offset=nil) -> Integer (6201.0)

IO.binwrite(self.to_s, *args)と同じです。

...IO.binwrite(self.to_s, *args)と同じです。


@see IO.binwrite...

IO#set_encoding_by_bom -> Encoding | nil (6126.0)

BOM から IO のエンコーディングを設定します。

...//emlist[例][ruby]{
File.write("bom.txt", "\u{FEFF}abc")
File.open("bom.txt", "rb") do |io|
p io.set_encoding_by_bom #=> #<Encoding:UTF-8>
str = io.read
p str #=> "abc"
p str.encoding #=> #<Encoding:UTF-8>
end

File.write("nobom.txt", "abc")
File.o...
...pen("nobom.txt", "rb") do |io|
p io.set_encoding_by_bom #=> nil
end
//}...

IO#pread(maxlen, offset, outbuf = "") -> string (107.0)

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

...ユーザー空間のIO層のバッファリングもバイパスします。

@param maxlen 読み込むバイト数を指定します。
@param offset 読み込み開始位置のファイルの先頭からのオフセットを指定します。
@param outbuf データを受け取る String を指...
...します。
@raise NotImplementedError システムコールがサポートされていない 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"...

絞り込み条件を変える

IO#pos=(n) (23.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 line two\n")...

IO#internal_encoding -> Encoding | nil (13.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
//}...