11 #ifndef _SMING_CORE_DATA_FILE_STREAM_H_ 12 #define _SMING_CORE_DATA_FILE_STREAM_H_ 14 #include "ReadWriteStream.h" 15 #include "FileSystem.h" 36 open(fileName, openFlags);
48 void attach(file_t file,
size_t size);
53 return open(fileName, openFlags);
74 size_t write(
const uint8_t* buffer,
size_t size)
override;
80 bool seek(
int len)
override;
158 int lastError = SPIFFS_OK;
int available() override
Return the total length of the stream.
Definition: FileStream.h:122
void attach(file_t file, size_t size)
Attach this stream object to an open file handle.
bool attach(const String &fileName, FileOpenFlags openFlags=eFO_ReadOnly) SMING_DEPRECATED
Definition: FileStream.h:51
size_t getPos() const
Get the offset of cursor from beginning of data.
Definition: FileStream.h:114
String fileName() const
Filename of file stream is attached to.
bool open(const String &fileName, FileOpenFlags openFlags=eFO_ReadOnly)
Open a file and attach this stream object to it.
bool isValid() const override
Determine if the stream object contains valid data.
Definition: FileStream.h:106
int getLastError()
determine if an error occurred during operation
Definition: FileStream.h:132
The string class.
Definition: WString.h:104
size_t write(const uint8_t *buffer, size_t size) override
Write chars to stream.
String getName() const override
Returns name of the resource.
Definition: FileStream.h:101
File stream class.
Definition: FileStream.h:24
FileStream(const String &fileName, FileOpenFlags openFlags=eFO_ReadOnly)
Create a file stream.
Definition: FileStream.h:34
bool fileIsEOF(file_t file)
Check if at end of file.
StreamType getStreamType() const override
Get the stream type.
Definition: FileStream.h:69
bool isFinished() override
Check if all data has been read.
Definition: FileStream.h:83
Read only file.
Definition: FileSystem.h:26
StreamType
Data stream type.
Definition: DataSourceStream.h:22
File data stream.
Definition: DataSourceStream.h:25
bool seek(int len) override
Move read cursor.
uint16_t readMemoryBlock(char *data, int bufSize) override
Read a block of memory.
Base class for read/write stream.
Definition: ReadWriteStream.h:23
String id() const override
Returns unique id of the resource.
FileOpenFlags
File open flags.
Definition: FileSystem.h:25
bool fileExist() const
Determine if file exists.
Definition: FileStream.h:96