|
CX Framework
Cross-platform C utility framework
|
Functions | |
| bool | sbufFSFileIn (StreamBuffer *sb, FSFile *file, bool close) |
| bool | sbufFSFilePRegisterPull (StreamBuffer *sb, FSFile *file, bool close) |
Functions for using low-level filesystem files as stream buffer data sources.
| bool sbufFSFileIn | ( | StreamBuffer * | sb, |
| FSFile * | file, | ||
| bool | close | ||
| ) |
bool sbufFSFileIn(StreamBuffer *sb, FSFile *file, bool close)
Reads a filesystem 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 | Filesystem file to read from (optionally closed based on close parameter) |
| close | If true, the file is closed after reading |
Example:
| bool sbufFSFilePRegisterPull | ( | StreamBuffer * | sb, |
| FSFile * | file, | ||
| bool | close | ||
| ) |
bool sbufFSFilePRegisterPull(StreamBuffer *sb, FSFile *file, bool close)
Registers a filesystem 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 sbufFSFileIn() when you need finer control over when data is read.
| sb | The stream buffer |
| file | Filesystem file to read from (optionally closed when producer finishes) |
| close | If true, the file is closed when the producer finishes |