getData

fun getData(): <Error class: unknown class>?

Returns a pointer to the serialized form of a #GVariant 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 deserialized from a corrupted serialized 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 serialized form, this function is O(1). If the value is not already in serialized form, serialization occurs implicitly and is approximately O(n) in the size of the result.

To deserialize the data returned by this function, in addition to the serialized data, you must know the type of the #GVariant, 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 serialized #GVariants 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 serialized data).

Return

the serialized form of @value, or null

Since

2.24