Class: Empp::Utils::ByteBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/empp/utils/bytebuffer.rb

Instance Method Summary collapse

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

#dataObject



27
28
29
# File 'lib/empp/utils/bytebuffer.rb', line 27

def data
  @buf
end

#to_sObject



31
32
33
# File 'lib/empp/utils/bytebuffer.rb', line 31

def to_s
  @buf.unpack("H*")
end