Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
FileStream Class Reference

File stream class. More...

#include <DataSourceStream.h>

Inheritance diagram for FileStream:
IDataSourceStream TemplateFileStream

Public Member Functions

 FileStream ()
 Create a file stream. More...
 
 FileStream (String fileName)
 
virtual bool attach (String fileName, FileOpenFlags openFlags)
 
virtual StreamType getStreamType ()
 Get the stream type. More...
 
virtual size_t write (uint8_t charToWrite)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
virtual uint16_t readMemoryBlock (char *data, int bufSize)
 Read a block of memory. More...
 
virtual bool seek (int len)
 Move read cursor. More...
 
virtual bool isFinished ()
 Check if stream is finished. More...
 
String fileName ()
 Filename of file stream is attached to. More...
 
bool fileExist ()
 True if file exists. More...
 
int getPos ()
 Get the offset of cursor from beginning of data. More...
 

Detailed Description

File stream class.

Constructor & Destructor Documentation

FileStream::FileStream ( )

Create a file stream.

Parameters
fileNameName of file to open

Member Function Documentation

bool FileStream::fileExist ( )

True if file exists.

String FileStream::fileName ( )

Filename of file stream is attached to.

int FileStream::getPos ( )
inline

Get the offset of cursor from beginning of data.

Return values
intCursor offset
virtual StreamType FileStream::getStreamType ( )
inlinevirtual

Get the stream type.

Return values
StreamTypeThe stream type.
Todo:
Return value of IDataSourceStream:getStreamType base class function should be of type StreamType, e.g. eSST_User

Implements IDataSourceStream.

Reimplemented in TemplateFileStream.

virtual bool FileStream::isFinished ( )
virtual

Check if stream is finished.

Return values
boolTrue on success.

Implements IDataSourceStream.

virtual uint16_t FileStream::readMemoryBlock ( char *  data,
int  bufSize 
)
virtual

Read a block of memory.

Parameters
dataPointer to the data to be read
bufSizeQuantity of chars to read
Return values
uint16_tQuantity of chars read
Todo:
Should IDataSourceStream::readMemoryBlock return same data type as its bufSize param?

Implements IDataSourceStream.

Reimplemented in TemplateFileStream.

virtual bool FileStream::seek ( int  len)
virtual

Move read cursor.

Parameters
lenPosition within stream to move cursor to
Return values
boolTrue on success.

Implements IDataSourceStream.

Reimplemented in TemplateFileStream.