Class: Appdash::Buffer

Inherits:
StringIO
  • Object
show all
Defined in:
lib/appdash/buffer.rb

Instance Method Summary collapse

Constructor Details

#initializeBuffer

Returns a new instance of Buffer.



6
7
8
9
# File 'lib/appdash/buffer.rb', line 6

def initialize
  super
  binmode
end

Instance Method Details

#bytesizeObject



17
18
19
# File 'lib/appdash/buffer.rb', line 17

def bytesize
  string.bytesize
end

#push(packet) ⇒ Object



11
12
13
14
15
# File 'lib/appdash/buffer.rb', line 11

def push(packet)
  payload = packet.serialize_to_string
  write_uvarint payload.bytesize
  write payload
end

#resetObject



21
22
23
24
# File 'lib/appdash/buffer.rb', line 21

def reset
  truncate(0)
  rewind
end