Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
EndlessMemoryStream.h
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/anakod/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * EndlessMemoryStream.h
8  *
9  ****/
10 
11 #ifndef _SMING_CORE_DATA_STREAM_ENDLESS_MEMORY_STREAM_H_
12 #define _SMING_CORE_DATA_STREAM_ENDLESS_MEMORY_STREAM_H_
13 
14 #include "MemoryDataStream.h"
15 
29 {
30 public:
32  {
33  delete stream;
34  }
35 
36  StreamType getStreamType() const override
37  {
38  return eSST_Memory;
39  }
40 
41  uint16_t readMemoryBlock(char* data, int bufSize) override
42  {
43  return stream ? stream->readMemoryBlock(data, bufSize) : 0;
44  }
45 
46  bool seek(int len) override;
47 
53  size_t write(const uint8_t* buffer, size_t size) override;
54 
55  bool isFinished() override
56  {
57  return false;
58  }
59 
60 private:
61  MemoryDataStream* stream = nullptr;
62 };
63 
65 #endif /* _SMING_CORE_DATA_STREAM_ENDLESS_MEMORY_STREAM_H_ */
uint16_t readMemoryBlock(char *data, int bufSize) override
Read a block of memory.
Definition: EndlessMemoryStream.h:41
Memory data stream.
Definition: DataSourceStream.h:24
bool seek(int len) override
Move read cursor.
StreamType getStreamType() const override
Get the stream type.
Definition: EndlessMemoryStream.h:36
StreamType
Data stream type.
Definition: DataSourceStream.h:22
uint16_t readMemoryBlock(char *data, int bufSize) override
Read a block of memory.
bool isFinished() override
Check if all data has been read.
Definition: EndlessMemoryStream.h:55
Memory stream that stores unlimited number of bytes.
Definition: EndlessMemoryStream.h:28
size_t write(const uint8_t *buffer, size_t size) override
Write chars to stream.
Base class for read/write stream.
Definition: ReadWriteStream.h:23
Definition: MemoryDataStream.h:29