Method: LEON::StringBuffer#writeUInt16BE

Defined in:
lib/string-buffer.rb

#writeUInt16BE(v, i) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/string-buffer.rb', line 154

def writeUInt16BE(v, i)
  bytez = StringBuffer.bytes(v, Constants::UNSIGNED_SHORT)
  add = ''
  bytez.each { |v|
    add += "#{v.chr}"
  }
  i = normalize(i)
  if i >= @buffer.length
    @buffer += add
  else
    @buffer = @buffer[0..i] + add + @buffer[(i + 2)..-1]
  end
  return i + 2
end