Sniff()

Updated: October 26, 2022

Synopsis:

#include <aoi.h>

int64_t (*Sniff)(void *ctx,
                 void *buf,
                 int64_t num);

Arguments:

ctx
The context for the stream you want to read from.
buf
The buffer into which you want to read data.
num
The number of bytes to be read from the stream (which should be the length of buf).

Description:

This function should sniff (i.e., nondestructively read) num bytes of data at the beginning of the stream. All streamers should implement this function. After any stream data are read with Read(), you can no longer use Sniff().

Returns:

The number of bytes successfully sniffed from the stream, or -1 if we're not at the beginning of the stream.