eaarl-io  1.0.1+71abbd4
EAARL Input/Output Library (Public API)
stream.h
Go to the documentation of this file.
1 #ifndef EAARLIO_STREAM_H
2 #define EAARLIO_STREAM_H
3 
13 #include "eaarlio/error.h"
14 #include <stdint.h>
15 #include <stdio.h>
16 #include <string.h>
17 
66 
87  uint64_t len,
88  unsigned char *buffer);
89 
109  uint64_t len,
110  unsigned char const *buffer);
111 
146  eaarlio_error (
147  *seek)(struct eaarlio_stream *self, int64_t offset, int whence);
148 
164  eaarlio_error (*tell)(struct eaarlio_stream *self, int64_t *position);
165 
172  void *data;
173 };
174 
180 #define eaarlio_stream_empty() \
181  (struct eaarlio_stream) \
182  { \
183  NULL, NULL, NULL, NULL, NULL, NULL \
184  }
185 
186 #endif
eaarlio_error(* close)(struct eaarlio_stream *self)
Close the stream.
Definition: stream.h:65
eaarlio_error(* write)(struct eaarlio_stream *self, uint64_t len, unsigned char const *buffer)
Writes bytes from a buffer to a stream.
Definition: stream.h:108
eaarlio_error
Definition: error.h:16
eaarlio_error(* seek)(struct eaarlio_stream *self, int64_t offset, int whence)
Set the current position for the stream.
Definition: stream.h:147
Error codes and handling.
eaarlio_error(* tell)(struct eaarlio_stream *self, int64_t *position)
Retrieve the current position in the stream.
Definition: stream.h:164
void * data
Internal data pointer.
Definition: stream.h:172
eaarlio_error(* read)(struct eaarlio_stream *self, uint64_t len, unsigned char *buffer)
Read bytes from a stream and place them in a buffer.
Definition: stream.h:86
Stream interface.
Definition: stream.h:47