#include <FakeStream.h>
Public Member Functions | |
FakeStream () | |
virtual | ~FakeStream () |
size_t | write (uint8_t val) |
void | flush () |
const String & | bytesWritten () |
void | setToEndOfStream () |
void | nextByte (byte b) |
int | available () |
int | read () |
int | peek () |
A fake stream which can be used in place of other streams to inject bytes to be read and to record any bytes written.
FakeStream::FakeStream | ( | ) |
Creates a fake stream. Until nextByte() is called all bytes returned from read() or peek() will be -1 (end-of-stream).
|
virtual |
Destroys this fake stream.
int FakeStream::available | ( | ) |
The number of bytes available to be read.
const String & FakeStream::bytesWritten | ( | ) |
The bytes written by calling write(uint8_t).
void FakeStream::flush | ( | ) |
Flushes this stream. Does nothing in this implementation.
void FakeStream::nextByte | ( | byte | b | ) |
int FakeStream::peek | ( | ) |
Reads a byte without removing it from the stream.
int FakeStream::read | ( | ) |
Reads a byte, removing it from the stream.
void FakeStream::setToEndOfStream | ( | ) |
size_t FakeStream::write | ( | uint8_t | val | ) |
Writes a byte to this stream. The byte is recorded by appending it to the internal store and can be observed by calling bytesWritten().
val | the byte to write |