Sha256: e8021ec8846a5e5d1f2890f4e6f5970e1987810d26ffa85c86e20847933711d4

Contents?: true

Size: 784 Bytes

Versions: 1

Compression:

Stored size: 784 Bytes

Contents

module Wiris
  class File < ::File
    def self.saveContent(file, str)
      out = write(file, true);
      out.write(str)
      out.close
    end

    def self.saveBytes(file, b)
      File.open(file, 'wb' ) do |output|
        b.bytes.each do  | byte |
           output.print byte.chr
        end
      end
    end

    def self.getBytes(file)
        return Bytes.new(IO.binread(file).unpack("C*"))
    end

    def self.getContent(file)
        return File.read(file)
    end

    def self.write(str, binary) 
      if (!binary)
         raise Exception,"Only binary files allowed!"
       end
       return File.open(str, 'wb')
    end

    def self.saveContent(file, str)
      IO.binwrite(file, str.force_encoding("UTF-8"))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wirispluginengine-3.62.0.1322 lib/src-generic/File.rb