istream_create()

istream_create()#

The istream_create function initializes and allocates an istream instance. This instance provides an input stream buffer (gbuffer_t) with specified sizes for handling data efficiently.

Prototype

PUBLIC istream_h istream_create(
    hgobj       gobj,
    size_t      data_size,
    size_t      max_size
);

Parameters

Parameter

Type

Description

gobj

hgobj

The GObj associated with the input stream.

data_size

size_t

The initial size of the data buffer.

max_size

size_t

The maximum allowable size of the buffer.


Return Value

Returns an istream_h handle to the created istream. If memory allocation fails, the function returns NULL.

Notes

  • The function allocates memory for the ISTREAM structure and initializes its internal attributes, including a gbuffer_t for data storage.

  • If the memory allocation for the buffer fails, the function cleans up and returns NULL.

  • Ensure to free the allocated istream using istream_destroy when it is no longer needed to avoid memory leaks.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples