Class: Appdash::Buffer
- Inherits:
-
StringIO
- Object
- StringIO
- Appdash::Buffer
- Defined in:
- lib/appdash/buffer.rb
Instance Method Summary collapse
- #bytesize ⇒ Object
-
#initialize ⇒ Buffer
constructor
A new instance of Buffer.
- #push(packet) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Buffer
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
#bytesize ⇒ Object
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 |
#reset ⇒ Object
21 22 23 24 |
# File 'lib/appdash/buffer.rb', line 21 def reset truncate(0) rewind end |