Class: Wiris::Bytes

Inherits:
Object
  • Object
show all
Defined in:
lib/src-generic/Bytes.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bytes) ⇒ Bytes

Returns a new instance of Bytes.



16
17
18
# File 'lib/src-generic/Bytes.rb', line 16

def initialize(bytes)
  @bytes = bytes
end

Class Method Details

.alloc(int) ⇒ Object



37
38
39
# File 'lib/src-generic/Bytes.rb', line 37

def self.alloc(int)
  return []
end

.ofData(data) ⇒ Object



25
26
27
# File 'lib/src-generic/Bytes.rb', line 25

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

.ofString(s) ⇒ Object



21
22
23
# File 'lib/src-generic/Bytes.rb', line 21

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

Instance Method Details

#bytesObject



12
13
14
# File 'lib/src-generic/Bytes.rb', line 12

def bytes
  @bytes
end

#bytes=(bytes) ⇒ Object



9
10
11
# File 'lib/src-generic/Bytes.rb', line 9

def bytes=(bytes)
  @bytes=bytes
end

#get(index) ⇒ Object



33
34
35
# File 'lib/src-generic/Bytes.rb', line 33

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

#getDataObject



29
30
31
# File 'lib/src-generic/Bytes.rb', line 29

def getData()
  return @bytes
end

#lengthObject



41
42
43
# File 'lib/src-generic/Bytes.rb', line 41

def length()
  return @bytes.length
end

#toStringObject



45
46
47
# File 'lib/src-generic/Bytes.rb', line 45

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