るりまサーチ

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

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file ctime
  4. file atime

クラス

モジュール

キーワード

検索結果

<< 1 2 3 > >>

File#size -> Integer (27121.0)

ファイルのサイズを返します。

...ファイルのサイズを返します。

//emlist[例][ruby]{
File
.open("/dev/null") do |f|
f.size #=> 0
end
//}

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

@raise Errno::EXXX 失敗した場合に発生します。

@see File#lstat...

File.size(path) -> Integer (27119.0)

FileTest.#size と同じです。

...
File
Test.#size と同じです。

@param path パスを表す文字列か IO オブジェクトを指定します。...

FileTest.#size(file) -> Integer (21234.0)

ファイルのサイズを返します。

...す。

@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise Errno::EXXX file が存在しない場合、あるいはシステムコールに失敗した場合に発生します。

@raise IOError 指定された IO オブジェクト file が既に clo...
...se されていた場合に発生します。

@see FileTest.#size?, FileTest.#zero?

例:
File
Test.size('/etc/passwd') # => 5925...

File::Stat#size -> Integer (21115.0)

ファイルサイズ(バイト単位)を返します。

...ファイルサイズ(バイト単位)を返します。

//emlist[][ruby]{
fs = File::Stat.new($0)
#例
p fs.size #=> 1548
//}...

File.size?(path) -> Integer | nil (15119.0)

FileTest.#size? と同じです。

...
File
Test.#size? と同じです。

@param path パスを表す文字列か IO オブジェクトを指定します。...

絞り込み条件を変える

FileTest.#size?(file) -> Integer | nil (9240.0)

ファイルのサイズを返します。ファイルが存在しない時や ファイルのサイズが0の時には nil を返します。

...m file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "test")
File
Test.size?("testfile") # => 4
File
....
...delete("testfile")
File
Test.size?("testfile") # => nil
//}

@see FileTest.#size, FileTest.#zero?...

File::Stat#size? -> Integer | nil (9133.0)

サイズが0の時にはnil、それ以外の場合はファイルサイズを返します。

...はnil、それ以外の場合はファイルサイズを返します。

//emlist[][ruby]{
require 'tempfile'

fp = Tempfile.new("temp")
p fp.size #=> 0
p File::Stat.new(fp.path).size? #=> nil
fp.print "not 0 "
fp.close
p FileTest.exist?(fp.path) #=> true
p File::Stat.new(fp.path).size? #=> 6
//}...

File::Stat#blksize -> Integer (9108.0)

望ましいI/Oのブロックサイズを返します。

...望ましいI/Oのブロックサイズを返します。

//emlist[][ruby]{
fs = File::Stat.new($0)
#例
p fs.blksize #=> nil
//}...

File.truncate(path, length) -> 0 (9020.0)

path で指定されたファイルのサイズを最大 length バイト にします。

...す文字列を指定します。

@param length 変更したいサイズを整数で与えます。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "1234567890")
File
.truncate("testfile", 5) # => 0
File
.size("testfile") # => 5
//}...

File#truncate(length) -> 0 (9014.0)

ファイルのサイズを最大 length バイトにします。

...書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX サイズの変更に失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "1234567890")
File
.open("testfile", "a") do |f|
f.truncate(5) # => 0
f.size # => 5
end
//}...

絞り込み条件を変える

<< 1 2 3 > >>