Class: CSstats::Parser::Writer::FileStreamer

Inherits:
Object
  • Object
show all
Defined in:
lib/csstats/parser/writer/file_streamer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ FileStreamer

Returns a new instance of FileStreamer.



9
10
11
# File 'lib/csstats/parser/writer/file_streamer.rb', line 9

def initialize(stream)
  @stream = stream
end

Instance Attribute Details

#streamObject (readonly)

Returns the value of attribute stream.



7
8
9
# File 'lib/csstats/parser/writer/file_streamer.rb', line 7

def stream
  @stream
end

Instance Method Details

#write_int_data(int) ⇒ Object



13
14
15
16
# File 'lib/csstats/parser/writer/file_streamer.rb', line 13

def write_int_data(int)
  data = [int].pack('V')
  stream.write(data)
end

#write_short_data(int) ⇒ Object



18
19
20
21
# File 'lib/csstats/parser/writer/file_streamer.rb', line 18

def write_short_data(int)
  data = [int].pack('v')
  stream.write(data)
end

#write_string_data(string) ⇒ Object



23
24
25
# File 'lib/csstats/parser/writer/file_streamer.rb', line 23

def write_string_data(string)
  stream.write(string)
end