|
CX Framework
Cross-platform C utility framework
|
Functions | |
| bool | sbufFileIn (StreamBuffer *sb, VFSFile *file, bool close) |
| bool | sbufFilePRegisterPull (StreamBuffer *sb, VFSFile *file, bool close) |
Functions for using VFS files as stream buffer data sources.
| bool sbufFileIn | ( | StreamBuffer * | sb, |
| VFSFile * | file, | ||
| bool | close | ||
| ) |
bool sbufFileIn(StreamBuffer *sb, VFSFile *file, bool close)
Reads a VFS file and pushes its entire contents into a stream buffer.
Automatically chunks the data based on the stream buffer's target size for efficient operation. The stream buffer is automatically finished after all data is read.
IMPORTANT: The stream buffer is invalidated after this call.
| sb | The stream buffer (invalidated after call) |
| file | VFS file to read from (optionally closed based on close parameter) |
| close | If true, the file is closed after reading |
Example:
| bool sbufFilePRegisterPull | ( | StreamBuffer * | sb, |
| VFSFile * | file, | ||
| bool | close | ||
| ) |
bool sbufFilePRegisterPull(StreamBuffer *sb, VFSFile *file, bool close)
Registers a VFS file as a producer with the stream buffer in pull mode.
In pull mode, the consumer pulls data as needed, and the file is read in chunks on demand. Use this instead of sbufFileIn() when you need finer control over when data is read.
| sb | The stream buffer |
| file | VFS file to read from (optionally closed when producer finishes) |
| close | If true, the file is closed when the producer finishes |