class Wiris::File
Public Class Methods
getBytes(file)
click to toggle source
# File lib/src-generic/File.rb, line 17 def self.getBytes(file) return Bytes.new(IO.binread(file).unpack("C*")) end
getContent(file)
click to toggle source
# File lib/src-generic/File.rb, line 21 def self.getContent(file) return File.read(file) end
saveBytes(file, b)
click to toggle source
# File lib/src-generic/File.rb, line 9 def self.saveBytes(file, b) File.open(file, 'wb' ) do |output| b.bytes.each do | byte | output.print byte.chr end end end
saveContent(file, str)
click to toggle source
# File lib/src-generic/File.rb, line 3 def self.saveContent(file, str) out = write(file, true); out.write(str) out.close end
write(str, binary)
click to toggle source
# File lib/src-generic/File.rb, line 25 def self.write(str, binary) if (!binary) raise Exception,"Only binary files allowed!" end return File.open(str, 'wb') end