120件ヒット
[1-100件を表示]
(0.191秒)
別のキーワード
クラス
- File (12)
- IO (72)
- StringIO (12)
-
Zlib
:: GzipWriter (24)
検索結果
先頭5件
-
Zlib
:: GzipWriter # close -> File (27164.0) -
フッターを書き出し、GzipWriter オブジェクトをクローズします。close と finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を 参照して下さい。
...フッターを書き出し、GzipWriter オブジェクトをクローズします。close と
finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を
参照して下さい。
注意: Ruby の finalizer の制約のため、GzipWriter オブジェクトは
必ずクローズしてく......。
require 'zlib'
def case_finish
filename='hoge1.gz'
gz = Zlib::GzipWriter.open(filename, 9)
gz.puts "hogehoge\n" * 100
f = gz.finish
p f.atime
# 例
#=> Sun Jul 06 15:43:57 +0900 2008
end
def case_close
filename='hoge1.gz'
gz = Zlib::GzipWriter.o......pen(filename, 9)
gz.puts "hogehoge\n" * 100
f = gz.close
begin
p f.atime
rescue IOError => err
puts err #=> closed stream
end
end
case_finish
case_close... -
IO
# close _ write -> nil (24473.0) -
書き込み用の IO を close します。
... close します。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX close に失敗した場合に発生します。
//emlist[例][ruby]{
f = IO.popen("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOError: no......t opened for writing
end
//}
@see IO#close, IO#closed?, IO#close_read......用の IO を close します。
既に close されていた場合には単に無視されます。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX close に失敗した場合に発生します。
//emlist[例][ruby]{
f = IO.po......pen("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOError: not opened for writing
end
//}
@see IO#close, IO#closed?, IO#close_read... -
StringIO
# closed? -> bool (12147.0) -
自身が既に close されていた場合に true を返します。そうでない場合は、false を返します。
...身が既に close されていた場合に true を返します。そうでない場合は、false を返します。
//emlist[例][ruby]{
require "stringio"
sio = StringIO.open("hoge")
p sio.closed? # => false
sio.close_read
p sio.closed? # => false
sio.close_write
p sio.closed? # => true
//}... -
Zlib
:: GzipWriter # finish -> File (12064.0) -
フッターを書き出し、GzipWriter オブジェクトをクローズします。close と finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を 参照して下さい。
...フッターを書き出し、GzipWriter オブジェクトをクローズします。close と
finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を
参照して下さい。
注意: Ruby の finalizer の制約のため、GzipWriter オブジェクトは
必ずクローズしてく......。
require 'zlib'
def case_finish
filename='hoge1.gz'
gz = Zlib::GzipWriter.open(filename, 9)
gz.puts "hogehoge\n" * 100
f = gz.finish
p f.atime
# 例
#=> Sun Jul 06 15:43:57 +0900 2008
end
def case_close
filename='hoge1.gz'
gz = Zlib::GzipWriter.o......pen(filename, 9)
gz.puts "hogehoge\n" * 100
f = gz.close
begin
p f.atime
rescue IOError => err
puts err #=> closed stream
end
end
case_finish
case_close... -
IO
# reopen(path) -> self (6238.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...path で指定されたファイルにストリームを繋ぎ換えます。
第二引数を省略したとき self のモードをそのまま引き継ぎます。
IO#pos, IO#lineno などはリセットされます。
@param path パスを表す文字列を指定します。
@param mode パ......@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is......line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}
@see Kernel.#open... -
IO
# reopen(path , mode) -> self (6238.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...path で指定されたファイルにストリームを繋ぎ換えます。
第二引数を省略したとき self のモードをそのまま引き継ぎます。
IO#pos, IO#lineno などはリセットされます。
@param path パスを表す文字列を指定します。
@param mode パ......@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is......line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}
@see Kernel.#open... -
IO
# fcntl(cmd , arg = 0) -> Integer (6225.0) -
IOに対してシステムコール fcntl を実行します。 機能の詳細は fcntl(2) を参照してください。 fcntl(2) が返した整数を返します。
...テムコール fcntl を実行します。
機能の詳細は fcntl(2) を参照してください。
fcntl(2) が返した整数を返します。
@param cmd IO に対するコマンドを、添付ライブラリ fcntl が提供している定数で指定します。
@param arg cmd に対する......tl(2) に渡します。
文字列の場合には Array#pack した構造体だとみなして渡します。
arg が nil か false の場合には 0を、true の場合には 1 を渡します。
@raise Errno::EXXX fcntl の実行に失敗した場合に発生します。
@r......rror 既に 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.fcnt... -
IO
# tell -> Integer (3325.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
//}... -
File
# flock(operation) -> 0 | false (291.0) -
ファイルをロックします。
...。
@param operation ロックに対する操作の種類を示す定数を指定します。
どのような定数が利用可能かは以下を参照して下さい。
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX operation に不......な整数を与えた場合などに発生します。
引数 operation に有効な定数は以下の通りです。定数は File::Constants で定義されていますが、
File クラスの親クラスの IO が File::Constants をインクルードしているので、
これらの定数は F......はロック対象のファイルは読み込みモード
("r", "r+" など)でオープンされている必要があります。そのよ
うなシステムでは読み込み可能でないファイルに対するロックは例外
Errno::EXXX が発生するかもしれません。
: LOCK_EX...