This is a base class for the streams.
Definition: stream.hpp:17
uint32_t get_sd() const
Get the stream descriptor of the stream.
Definition: stream.hpp:37
BaseStream()
Constructs a new empty Base Stream object.
Definition: stream.hpp:22
bool initialized
True if the stream is initialized, false if it is closed.
Definition: stream.hpp:62
BaseStream(uint32_t sd)
Constructs a new initilized Base Stream object.
Definition: stream.hpp:28
uint32_t sd
The stream descriptor.
Definition: stream.hpp:60
bool is_initialized() const
Check whether the stream object has been initialized or not.
Definition: stream.hpp:46
edjx::error::StreamError close()
Close the stream.
Read stream class.
Definition: stream.hpp:120
edjx::error::StreamError pipe_to(WriteStream &write_stream)
Pipes a read stream into a write stream.
edjx::error::StreamError read_all(std::vector< uint8_t > &result)
Reads and returns all data from the stream until the end of stream.
edjx::error::StreamError read_chunk(std::vector< uint8_t > &result)
Read a chunk of binary data from the stream.
ReadStream()
Constructs a new empty Read Stream object.
Definition: stream.hpp:125
ReadStream(uint32_t sd)
Constructs a new initilized Read Stream object.
Definition: stream.hpp:131
This class represents a write stream.
Definition: stream.hpp:68
edjx::error::StreamError write_chunk(const std::vector< uint8_t > &bytes)
Write a chunk of binary data into the write stream.
edjx::error::StreamError write_chunk(const std::string &text)
Write a chunk of text into the write stream.
edjx::error::StreamError abort()
Aborts sending data and closes the stream.
WriteStream()
Constructs a new empty Write Stream object.
Definition: stream.hpp:73
WriteStream(uint32_t sd)
Constructs a new initilized Write Stream object.
Definition: stream.hpp:79
StreamError
Enum that describes values returned by streaming functions.
Definition: error.hpp:243