Class: Empp::Utils::ByteBuffer
- Inherits:
-
Object
- Object
- Empp::Utils::ByteBuffer
- Defined in:
- lib/empp/utils/bytebuffer.rb
Instance Method Summary collapse
- #append_string(strValue) ⇒ Object
- #append_uint_be(intValue) ⇒ Object
- #append_uint_le(intValue) ⇒ Object
- #data ⇒ Object
-
#initialize(data = nil) ⇒ ByteBuffer
constructor
A new instance of ByteBuffer.
- #to_s ⇒ Object
Constructor Details
#initialize(data = nil) ⇒ ByteBuffer
Returns a new instance of ByteBuffer.
10 11 12 13 |
# File 'lib/empp/utils/bytebuffer.rb', line 10 def initialize(data = nil) @buf = data || '' @offset = 0 end |
Instance Method Details
#append_string(strValue) ⇒ Object
23 24 25 |
# File 'lib/empp/utils/bytebuffer.rb', line 23 def append_string(strValue) @buf << strValue end |
#append_uint_be(intValue) ⇒ Object
15 16 17 |
# File 'lib/empp/utils/bytebuffer.rb', line 15 def append_uint_be(intValue) @buf << Utils.getUintBe(intValue) end |
#append_uint_le(intValue) ⇒ Object
19 20 21 |
# File 'lib/empp/utils/bytebuffer.rb', line 19 def append_uint_le(intValue) @buf << Utils.getUintLe(intValue) end |
#data ⇒ Object
27 28 29 |
# File 'lib/empp/utils/bytebuffer.rb', line 27 def data @buf end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/empp/utils/bytebuffer.rb', line 31 def to_s @buf.unpack("H*") end |