18#include "pw_stream/stream.h"
27 StdFileReader(
const char* path) : stream_(path, std::ios::binary) {}
29 void Close() { stream_.close(); }
37 std::ifstream stream_;
44 : stream_(path, std::ios::binary | std::ios::trunc) {}
46 void Close() { stream_.close(); }
53 std::ofstream stream_;
Definition: status_with_size.h:51
Wraps an std::ifstream with the pw::stream::Reader interface.
Definition: std_file_stream.h:25
size_t ConservativeLimit(LimitType limit) const override
Status DoSeek(ptrdiff_t offset, Whence origin) override
Virtual Seek() function implemented by derived classes.
StatusWithSize DoRead(ByteSpan dest) override
Virtual Read() function implemented by derived classes.
Wraps an std::ofstream with the pw::stream::Writer interface.
Definition: std_file_stream.h:41
Status DoSeek(ptrdiff_t offset, Whence origin) override
Virtual Seek() function implemented by derived classes.
Status DoWrite(ConstByteSpan data) override
Virtual Write() function implemented by derived classes.
Whence
Positions from which to seek.
Definition: stream.h:48