ByteArray
Object Hierarchy:
Description:
[ Compact ]
[ Version ( since = "2.22" ) ]
[ CCode ( cprefix = "g_byte_array_" , ref_function = "g_byte_array_ref" , type_id = "G_TYPE_BYTE_ARRAY" , unref_function = "g_byte_array_unref" ) ]
public class ByteArray
Contains the public fields of a `GByteArray`.
Content:
Static methods:
Creation methods:
- public ByteArray ()
Creates a new `GByteArray` with a reference count of 1.
- public ByteArray.sized (uint reserved_size)
Creates a new `GByteArray` with reserved_size bytes
preallocated.
- public ByteArray.take (owned uint8[] data)
Creates a byte array containing the data.
Methods:
- public void append (uint8[] data)
Adds the given bytes to the end of the `GByteArray`.
- public void prepend (uint8[] data)
Adds the given data to the start of the `GByteArray`.
- public void remove_index (uint index)
Removes the byte at the given index from a `GByteArray`.
- public void remove_index_fast (uint index)
Removes the byte at the given index from a `GByteArray`.
- public void remove_range (uint index, uint length)
Removes the given number of bytes starting at the given index from a
`GByteArray`.
- public void set_size (uint length)
Sets the size of the `GByteArray`, expanding it if necessary.
- public void sort (CompareFunc<int8> compare_func)
Sorts a byte array, using compare_func which should be a
`qsort()`-style comparison function (returns less than zero for first arg is less than second arg, zero for equal, greater than zero
if first arg is greater than second arg).
- public void sort_with_data (CompareDataFunc<int8> compare_func)
Like [func@GLib.
- public uint8[] steal ()
Frees the data in the array and resets the size to zero, while the
underlying array is preserved for use elsewhere and returned to the caller.
Fields: