Class: Haxe::Io::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/haxe/io/output.rb

Direct Known Subclasses

Sys::Io::FileOutput

Instance Method Summary collapse

Instance Method Details

#write_byte(c) ⇒ Object



8
9
10
# File 'lib/lib/haxe/io/output.rb', line 8

def write_byte(c)
  raise hx_raise("Not implemented")
end

#write_bytes(s, pos, len) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lib/haxe/io/output.rb', line 12

def write_bytes(s,pos,len)
  k = len
  b = s.b
  raise hx_raise(::Haxe::Io::Error.outside_bounds) if pos < 0 || len < 0 || pos + len > s.length
  while(k > 0) 
    self.write_byte(b[pos])
    pos+=1
    k-=1
  end
  len
end

#write_full_bytes(s, pos, len) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/lib/haxe/io/output.rb', line 24

def write_full_bytes(s,pos,len)
  while(len > 0) 
    k = self.write_bytes(s,pos,len)
    pos += k
    len -= k
  end
end

#write_string(s) ⇒ Object



32
33
34
35
# File 'lib/lib/haxe/io/output.rb', line 32

def write_string(s)
  b = ::Haxe::Io::Bytes.of_string(s)
  self.write_full_bytes(b,0,b.length)
end