GLib.Variant.prototype.get_data
function get_data(): void { // Gjs wrapper for g_variant_get_data() }
Returns a pointer to the serialised form of a GLib.Variant instance. The returned data may not be in fully-normalised form if read from an untrusted source. The returned data must not be freed; it remains valid for as long as value exists.
If value is a fixed-sized value that was deserialised from a corrupted serialised container then null may be returned. In this case, the proper thing to do is typically to use the appropriate number of nul bytes in place of value. If value is not fixed-sized then null is never returned.
In the case that value is already in serialised form, this function is O(1). If the value is not already in serialised form, serialisation occurs implicitly and is approximately O(n) in the size of the result.
To deserialise the data returned by this function, in addition to the serialised data, you must know the type of the GLib.Variant, and (if the machine might be different) the endianness of the machine that stored it. As a result, file formats or network messages that incorporate serialised GLib.Variant<!---->s must include this information either implicitly (for instance "the file always contains a %G_VARIANT_TYPE_VARIANT and it is always in little-endian order") or explicitly (by storing the type and/or endianness in addition to the serialised data).
Since 2.24
- Returns
the serialised form of value, or null