Method: Cosmos::Structure#buffer

Defined in:
lib/cosmos/packets/structure.rb

#buffer(copy = true) ⇒ String

Get the buffer used by the structure. The current buffer is copied and thus modifications to the returned buffer will have no effect on the structure items.

Parameters:

Returns:

  • (String)

    Data buffer backing the structure



438
439
440
441
442
443
444
445
# File 'lib/cosmos/packets/structure.rb', line 438

def buffer(copy = true)
  local_buffer = allocate_buffer_if_needed()
  if copy
    return local_buffer.dup
  else
    return local_buffer
  end
end