ReadWriteStream

class ReadWriteStream : public IDataSourceStream

Base class for read/write stream.

Subclassed by CircularBuffer, EndlessMemoryStream, HardwareSerial, IFS::FileStream, LimitedMemoryStream, MemoryDataStream, OtaUpgrade::BasicStream, Storage::PartitionStream

Public Functions

inline virtual size_t write(uint8_t charToWrite) override

From Stream class: We don’t write using this stream.

Parameters

charToWrite

virtual size_t write(const uint8_t *buffer, size_t size) = 0

Write chars to stream.

Note

Although this is defined in the Print class, ReadWriteStream uses this as the core output method so descendants are required to implement it

Parameters
  • buffer – Pointer to buffer to write to the stream

  • size – Quantity of chars to write

Returns

size_t – Quantity of chars written to stream

virtual size_t copyFrom(IDataSourceStream *source, size_t size = SIZE_MAX)

Copy data from a source stream.

Parameters
  • source – Stream to read data from

  • size – Quantity of chars to write, determines size of intermediate buffer to use

Returns

size_t – Quantity of chars actually written, may be less than requested