#ifndef BUFFER_HEADER
#define BUFFER_HEADER

#include <stddef.h>

struct BUFFER;
typedef struct BUFFER Buffer;

Buffer *buffer_new();
void buffer_free(Buffer **b);

int buffer_printf(Buffer *b, char *format, ...);
size_t buffer_write(const void *buffer, size_t size, size_t count, Buffer *b);
size_t buffer_read(void *buffer, size_t size, size_t count, Buffer *b);
size_t buffer_skip(Buffer *b, size_t bytes);
int buffer_error(Buffer *b);
int buffer_eof(Buffer *b);

char *buffer_raw(Buffer *b);
int buffer_size(Buffer *b);
int buffer_bytes(Buffer *b);

#endif
