class GLib::ByteArray

Overrides for GByteArray, GLib's automatically growing array of bytes.

Public Class Methods

from(data) click to toggle source
# File lib/ffi-glib/byte_array.rb, line 19
def self.from(data)
  case data
  when self
    data
  else
    new.append(data)
  end
end

Public Instance Methods

append(data) click to toggle source
# File lib/ffi-glib/byte_array.rb, line 12
def append(data)
  bytes = GirFFI::InPointer.from_utf8 data
  len = data.bytesize
  Lib.g_byte_array_append(to_ptr, bytes, len)
  self
end
to_string() click to toggle source
# File lib/ffi-glib/byte_array.rb, line 8
def to_string
  data.read_string len
end