Stream Classes

group stream

Data stream classes.


using FlashMemoryStream = FSTR::Stream

Provides a read-only stream buffer on flash storage.

using TemplateFlashMemoryStream = FSTR::TemplateStream

Template stream using content stored in flash.

class CircularBuffer : public ReadWriteStream
#include <CircularBuffer.h>

Circular stream class.

Base class for data source stream

class IDataSourceStream : public Stream
#include <DataSourceStream.h>

Base class for read-only stream.

Subclassed by FSTR::Stream, Graphics::SubStream, IFS::FWFS::ArchiveStream, MultiStream, ReadWriteStream, RtttlJsonListStream, SectionStream, SharedMemoryStream< T >, StreamTransformer, TemplateStream, UPnP::DescriptionStream, UrlencodedOutputStream, XorOutputStream

class EndlessMemoryStream : public ReadWriteStream
#include <EndlessMemoryStream.h>

Memory stream that stores unlimited number of bytes.

Memory is allocated on write and released when all written bytes have been read out. This behaviour differs from a circular buffer as the size is not fixed.

class FileStream : public IFS::FileStream
#include <FileStream.h>

File stream class.

class GdbFileStream : public IFS::FileStream
#include <GdbFileStream.h>

GDB File stream class to provide access to host files whilst running under debugger.

class DirectoryTemplate : public SectionTemplate
#include <DirectoryTemplate.h>

Directory stream class.

Subclassed by IFS::HtmlDirectoryTemplate, IFS::JsonDirectoryTemplate

class FileStream : public IFS::FsBase, public ReadWriteStream
#include <FileStream.h>

File stream class.

Subclassed by FileStream, GdbFileStream, HostFileStream

class HtmlDirectoryTemplate : public IFS::DirectoryTemplate
#include <HtmlDirectoryTemplate.h>

Read-only stream access to directory listing with HTML output.

class LimitedMemoryStream : public ReadWriteStream
#include <LimitedMemoryStream.h>

Memory stream operating on fixed-size buffer Once the limit is reached the stream will discard incoming bytes on write.

class LimitedWriteStream : public StreamWrapper
#include <LimitedWriteStream.h>

A stream wrapper class that limits the number of bytes that can be written. Helpful when writing on a file system or memory should be limited to the available size of the media.

class MemoryDataStream : public ReadWriteStream
#include <MemoryDataStream.h>

Read/write stream using expandable memory buffer.

This is intended to allow data to be streamed into it, then streamed back out at a later date.

It is not intended to have data continuously written in and read out; memory is not reclaimed as it is read.

Subclassed by JsonObjectStream, UPnP::ActionResponse::Stream

class MultiStream : public IDataSourceStream
#include <MultiStream.h>

Base class for read-only stream which generates output from multiple source streams.

Subclassed by MultipartStream, StreamChain

class ReadWriteStream : public IDataSourceStream
#include <ReadWriteStream.h>

Base class for read/write stream.

Subclassed by CircularBuffer, EndlessMemoryStream, HardwareSerial, IFS::FileStream, LimitedMemoryStream, MemoryDataStream, Ota::UpgradeOutputStream, OtaUpgrade::BasicStream, Storage::PartitionStream, StreamWrapper, USB::CDC::UsbSerial

template<typename T>
class SharedMemoryStream : public IDataSourceStream
#include <SharedMemoryStream.h>

Memory stream operating on fixed shared buffer.

One reason for templating this class is for distinction between char or const char types, to avoid dangerous casts. Elements may be structures or other types.

class StreamWrapper : public ReadWriteStream
#include <StreamWrapper.h>

An abstract class that provides a wrapper around a stream.

Subclassed by LimitedWriteStream, PartCheckerStream

class TemplateFileStream : public TemplateStream
#include <TemplateFileStream.h>

Template stream using content from the filesystem.

class TemplateStream : public IDataSourceStream
#include <TemplateStream.h>

Stream which performs variable-value substitution on-the-fly.

Template uses {varname} style markers which are replaced as the stream is read.

Note: There must be no whitespace after the opening brace. For example, { varname } will be emitted as-is without modification.

This allows inclusion of CSS fragments such as td { padding: 0 10px; } in HTML.

If necessary, use double-braces {{varname}} in templates and enable by calling setDoubleBraces(true).

Invalid tags, such as {"abc"} will be ignored, so JSON templates do not require special treatment.

Subclassed by FSTR::TemplateStream, SectionTemplate, TemplateFileStream

class XorOutputStream : public IDataSourceStream
#include <XorOutputStream.h>

Xors original stream content with the specified mask.

class HostFileStream : public IFS::FileStream
#include <HostFileStream.h>

Host File stream class.

class TemplateStream : public TemplateStream
#include <TemplateStream.hpp>

Template Flash memory stream class.

class Base64OutputStream : public StreamTransformer
#include <Base64OutputStream.h>

Read-only stream to emit base64-encoded content from source stream.

class ChunkedStream : public StreamTransformer
#include <ChunkedStream.h>

Read-only stream to obtain data using HTTP chunked encoding.

Used where total length of stream is not known in advance

class MultipartStream : public MultiStream
#include <MultipartStream.h>

Read-only stream for creating HTTP multi-part content.

class QuotedPrintableOutputStream : public StreamTransformer
#include <QuotedPrintableOutputStream.h>

Read-only stream that transforms bytes of data into quoted printable data stream.

class UrlencodedOutputStream : public IDataSourceStream
#include <UrlencodedOutputStream.h>

Represents key-value pairs as urlencoded string content.

class PartitionStream : public ReadWriteStream
#include <PartitionStream.h>

Stream operating directory on a Storage partition.

To support write operations, the target region must be erased first.

class JsonObjectStream : public MemoryDataStream
#include <JsonObjectStream.h>

JsonObject stream class.

class StreamTransformer : public IDataSourceStream

Class that can be used to transform streams of data on the fly.

Subclassed by Base64OutputStream, ChunkedStream, QuotedPrintableOutputStream

Public Functions

inline virtual void saveState()

A method that backs up the current state.

inline virtual void restoreState()

A method that restores the last backed up state.

Protected Functions

virtual size_t transform(const uint8_t *in, size_t inLength, uint8_t *out, size_t outLength) = 0

Inherited class implements this method to transform a block of data.


Called with in = nullptr and inLength = 0 at end of input stream

  • in – source data

  • inLength – source data length

  • out – output buffer

  • outLength – size of output buffer

Return values:

size_t – number of output bytes written