Banjo API 0.0.1
Multi-purpose C99 API
Loading...
Searching...
No Matches
stream.h File Reference

Header file for bj_stream_t struct and related functions.

#include <banjo/api.h>
#include <banjo/error.h>
Include dependency graph for stream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define bj_stream_read_t(stream, type, buffer)
 Reads data of a specified type from the stream into a buffer.
 
#define bj_stream_skip_t(stream, type)
 Skips reading data of a specified type from the stream.
 

Typedefs

typedef struct bj_stream_t bj_stream
 Structure representing a stream of data.
 

Enumerations

enum  bj_seek_origin { BJ_SEEK_BEGIN = 0x00 , BJ_SEEK_CURRENT = 0x01 , BJ_SEEK_END = 0x02 }
 Position in a bj_stream to use for origin. More...
 

Functions

bj_streambj_stream_alloc (void)
 Allocate a new bj_stream object.
 
bj_streambj_stream_new_read (const void *p_data, size_t length)
 Creates a new bj_stream for reading from a memory buffer.
 
bj_streambj_stream_new_read_from_file (const char *p_path, bj_error **p_error)
 Creates a new bj_stream for reading from a file.
 
void bj_stream_del (bj_stream *p_stream)
 Deletes a bj_stream object and releases associated memory.
 
size_t bj_stream_read (bj_stream *p_stream, void *p_dest, size_t count)
 Reads data from the stream into a destination buffer.
 
size_t bj_stream_len (bj_stream *p_stream)
 Get the size of the stream.
 
size_t bj_stream_seek (bj_stream *p_stream, ptrdiff_t position, bj_seek_origin from)
 Seeks to a new position in the stream relative to a specified origin.
 
size_t bj_stream_tell (bj_stream *p_stream)
 Returns the current position of the cursor in the stream.