A simple refcounted data type representing an immutable sequence of zero or more bytes from an unspecified origin.
The purpose of a glib.Bytes is to keep the memory region that it holds alive for as long as anyone holds a reference to the bytes. When the last reference count is dropped, the memory is released. Multiple unrelated callers can use byte data in the glib.Bytes without coordinating their activities, resting assured that the byte data will not change or move while they hold a reference.
A glib.Bytes can come from many different origins that may have different procedures for freeing the memory region. Examples are memory from g_malloc(), from memory slices, from a glib.MappedFile or memory from other allocators.
glib.Bytes work well as keys in glib.HashTable Use Bytes.equal and Bytes.hash as parameters to HashTable.new or HashTable.newFull. glib.Bytes can also be used as keys in a GTree by passing the Bytes.compare function to g_tree_new().
The data pointed to by this bytes must not be modified. For a mutable array of bytes see glib.ByteArray Use Bytes.unrefToArray to create a mutable array for a glib.Bytes sequence. To create an immutable glib.Bytes from a mutable glib.ByteArray, use the ByteArray.freeToBytes function.
Sets our main struct and passes it to the parent class.
Creates a new glib.Bytes from data.
Creates a glib.Bytes from data.
A destructor is present on this object, but not explicitly documented in the source.
Compares the two glib.Bytes values.
Compares the two glib.Bytes values being pointed to and returns TRUE if they are equal.
Get the main Gtk struct
Get the byte data in the glib.Bytes This data should not be modified.
Get the size of the byte data in the glib.Bytes
the main Gtk struct as a void*
Creates an integer hash code for the byte data in the glib.Bytes
Increase the reference count on bytes.
Releases a reference on bytes. This may result in the bytes being freed. If bytes is NULL, it will return immediately.
Unreferences the bytes, and returns a new mutable glib.ByteArray containing the same byte data.
Unreferences the bytes, and returns a pointer the same byte data contents.
the main Gtk struct