23 const char* filename = 0,
24 bool close_on_finalize =
false);
29 void open(
const char* filename);
33 void seek(
unsigned offset);
42 const bool m_close_on_finalize;
44 unsigned m_last_commit;
55 const char* filename = 0,
56 bool close_on_finalize =
false);
63 void open(
const char* filename,
unsigned len = 0);
73 const bool m_close_on_finalize;
Read bytes or packets from a file.
FileReader(const char *filename=0, bool close_on_finalize=false)
Create the FileWriter object.
void read_finalize() override
Consume any remaining bytes in this frame, if applicable.
void open(const char *filename, unsigned len=0)
Open the specified file to read the next frame.
bool read_bytes(unsigned nbytes, void *dst)
Read 0 or more bytes into a buffer.
unsigned get_read_ready() const override
How many bytes can be read without blocking?
bool read_consume(unsigned nbytes)
Read and discard 0 or more bytes.
u8 read_next() override
Read the next byte from the underlying buffer or device.
Write bytes or packets to a file.
unsigned get_write_space() const override
How many bytes can be written without blocking?
void write_bytes(unsigned nbytes, const void *src)
Write 0 or more bytes from a buffer.
void write_abort() override
If possible, abort the current partially-written packet.
FileWriter(const char *filename=0, bool close_on_finalize=false)
Create the FileWriter object.
bool write_finalize() override
Mark end of frame and release temporary working data.
void write_next(u8 data) override
Write the next byte to the underlying buffer or device.
void open(const char *filename)
Open the specified file.
void seek(unsigned offset)
Move write cursor to the specified absolute offset.
Abstract API for reading byte-streams and packets.
Abstract API for writing byte-streams and packets.
I/O interface core definitions.