別のキーワード
クラス
- File (48)
- IO (84)
- StringIO (12)
-
Zlib
:: GzipWriter (24)
検索結果
先頭5件
-
Zlib
:: GzipWriter # close -> File (24158.0) -
フッターを書き出し、GzipWriter オブジェクトをクローズします。close と finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を 参照して下さい。
...フッターを書き出し、GzipWriter オブジェクトをクローズします。close と
finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を
参照して下さい。
注意: Ruby の finalizer の制約のため、GzipWriter オブジェクトは
必ずクローズしてく......Writer.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.open(filename, 9)
gz.puts "hogehoge\n" * 100
f = gz.close
begin
p f.at......ime
rescue IOError => err
puts err #=> closed stream
end
end
case_finish
case_close... -
IO
# close _ write -> nil (18361.0) -
書き込み用の IO を close します。
...用の IO を close します。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX close に失敗した場合に発生します。
//emlist[例][ruby]{
f = IO.popen("/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......用の 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 (9141.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 (9058.0) -
フッターを書き出し、GzipWriter オブジェクトをクローズします。close と finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を 参照して下さい。
...フッターを書き出し、GzipWriter オブジェクトをクローズします。close と
finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を
参照して下さい。
注意: Ruby の finalizer の制約のため、GzipWriter オブジェクトは
必ずクローズしてく......Writer.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.open(filename, 9)
gz.puts "hogehoge\n" * 100
f = gz.close
begin
p f.at......ime
rescue IOError => err
puts err #=> closed stream
end
end
case_finish
case_close... -
File
# atime -> Time (6219.0) -
最終アクセス時刻を Time オブジェクトとして返します。
...刻を Time オブジェクトとして返します。
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |......f| f.atime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#ctime, File#mtime......f| f.atime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#ctime, File#mtime, File#birthtime... -
File
# ctime -> Time (6219.0) -
状態が最後に変更された時刻を Time オブジェクトとして返します。状態の変更とは chmod などによるものです。
...を Time オブジェクトとして返します。状態の変更とは chmod などによるものです。
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{......IO.write("testfile", "test")
File.open("testfile") { |f| f.ctime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#mtime......IO.write("testfile", "test")
File.open("testfile") { |f| f.ctime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#mtime, File#birthtime... -
File
# mtime -> Time (6219.0) -
最終更新時刻を Time オブジェクトとして返します。
...刻を Time オブジェクトとして返します。
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |......f| f.mtime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#ctime......f| f.mtime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#ctime, File#birthtime... -
IO
# stat -> File :: Stat (6219.0) -
ファイルのステータスを含む File::Stat オブジェクトを生成して 返します。
...:Stat オブジェクトを生成して
返します。
@raise Errno::EXXX ステータスの読み込みに失敗した場合に発生します。
@raise IOError 既に close されていた場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two......\n")
File.open("testfile") do |f|
s = f.stat
"%o" % s.mode # => "100644"
s.blksize # => 4096
s.atime # => 2018-03-01 23:19:59 +0900
end
//}
@see File#lstat, File.stat, File.lstat... -
IO
# fcntl(cmd , arg = 0) -> Integer (6119.0) -
IOに対してシステムコール fcntl を実行します。 機能の詳細は fcntl(2) を参照してください。 fcntl(2) が返した整数を返します。
...IOに対してシステムコール fcntl を実行します。
機能の詳細は fcntl(2) を参照してください。
fcntl(2) が返した整数を返します。
@param cmd IO に対するコマンドを、添付ライブラリ fcntl が提供している定数で指定します。
@param......の時にはその値を fcntl(2) に渡します。
文字列の場合には Array#pack した構造体だとみなして渡します。
arg が nil か false の場合には 0を、true の場合には 1 を渡します。
@raise Errno::EXXX fcntl の実行に失敗した場......に 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:...