Sha256: 666c865e4b3b3e895cc4a9b5a8f05d9af512174c3651e63b3f607f340a921626

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

# This class encapsulates the data structure of an array of bytes. Depending
# on the platform the actual byte array ca be a String, an array of integers,
# or the best choice everywhere.
# It is encouraged to use this structure specially for input/output 
# operations where large byte arrays have to be handled.

module Wiris
  class Bytes
    def bytes=(bytes)
      @bytes=bytes
    end
    def bytes
      @bytes
    end

    def initialize(bytes)
      @bytes = bytes
    end


    def self.ofString(s)
      return Bytes.new(s.force_encoding("ISO-8859-1").bytes.to_a)
    end

    def self.ofData(data)
      return Bytes.new(data)
    end

    def getData()
      return @bytes
    end

    def get(index)
      return @bytes[index]
    end

    def self.alloc(int)
      return []
    end

    def length()
      return @bytes.length
    end

    def toString()
      return @bytes.pack('c*').force_encoding("ISO-8859-1")
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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