# BufferStream ## **Overview** **Related Modules:** [Format](Format.md) **Description:** Defines the function for reading stream data. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Data Fields

Variable Name

Description

ReadData )(void *handle, uint8_t *data, int32_t size, int32_t timeOutMs, DataFlags *flags)

int32_t(* 

Reads data from streams, save the data to the buffer pointed by data with the specified size, and returns the size of the read data and type.

GetReadableSize )(const void *handle)

int32_t(* 

Obtains the size of data that can be read.

handle

void * 

## **Details** ## **Field Documentation** ## GetReadableSize ``` int32_t(* BufferStream::GetReadableSize) (const void *[handle](BufferStream.md#ae2019a77aba73fa96d5a716155c7fb7f)) ``` **Description:** Obtains the size of data that can be read. Before reading data, you should call this function to check whether there is data to read. **Parameters:**

Name

Description

handle Indicates the pointer to the context handle.
**Returns:** Returns the size of the read data. ## handle ``` void* BufferStream::handle ``` **Description:** Context handle ## ReadData ``` int32_t(* BufferStream::ReadData) (void *[handle](BufferStream.md#ae2019a77aba73fa96d5a716155c7fb7f), uint8_t *data, int32_t size, int32_t timeOutMs, [DataFlags](Format.md#gacff079fdf8427c743f9197ea5be33a7f) *flags) ``` **Description:** Reads data from streams, save the data to the buffer pointed by **data** with the specified **size**, and returns the size of the read data and type. **Parameters:**

Name

Description

handle Indicates the pointer to the context handle.
data Indicates the pointer to the buffer to store the read data. The memory is allocated by the caller.
size Indicates the size of the available buffer memory.
timeOutMs Indicates read operation wait time. The value 0 means no wait time.
flags Indicates the pointer to the type of the read data, see DataFlags.
**Returns:** Returns the size of the read data.