map


Description:

[ CCode ( array_length = false ) ]
public unowned uint8[]? map (size_t size)

Gets the first return.length bytes stored in the this.

The returned pointer is valid until the next function is called on the adapter.

Note that setting the returned pointer as the data of a Buffer is incorrect for general-purpose plugins. The reason is that if a downstream element stores the buffer so that it has access to it outside of the bounds of its chain function, the buffer will have an invalid data pointer after your element flushes the bytes. In that case you should use take, which returns a freshly-allocated buffer that you can set as Buffer memory or the potentially more performant take_buffer.

Returns null if return.length bytes are not available.

Parameters:

this

a Adapter

size

the number of bytes to map/peek

Returns:

a pointer to the first return.length bytes of data, or null