C++ edjLibrary SDK
Loading...
Searching...
No Matches
Public Member Functions | List of all members
edjx::stream::ReadStream Class Reference

Read stream class. More...

#include <stream.hpp>

Inheritance diagram for edjx::stream::ReadStream:
edjx::stream::BaseStream

Public Member Functions

 ReadStream ()
 Constructs a new empty Read Stream object. More...
 
 ReadStream (uint32_t sd)
 Constructs a new initilized Read Stream object. More...
 
edjx::error::StreamError read_chunk (std::vector< uint8_t > &result)
 Read a chunk of binary data from the stream. More...
 
edjx::error::StreamError pipe_to (WriteStream &write_stream)
 Pipes a read stream into a write stream. More...
 
edjx::error::StreamError read_all (std::vector< uint8_t > &result)
 Reads and returns all data from the stream until the end of stream. More...
 
- Public Member Functions inherited from edjx::stream::BaseStream
 BaseStream ()
 Constructs a new empty Base Stream object. More...
 
 BaseStream (uint32_t sd)
 Constructs a new initilized Base Stream object. More...
 
uint32_t get_sd () const
 Get the stream descriptor of the stream. More...
 
bool is_initialized () const
 Check whether the stream object has been initialized or not. More...
 
edjx::error::StreamError close ()
 Close the stream. More...
 

Additional Inherited Members

- Protected Attributes inherited from edjx::stream::BaseStream
uint32_t sd
 The stream descriptor. More...
 
bool initialized
 True if the stream is initialized, false if it is closed. More...
 

Detailed Description

Read stream class.

Constructor & Destructor Documentation

◆ ReadStream() [1/2]

edjx::stream::ReadStream::ReadStream ( )
inline

Constructs a new empty Read Stream object.

◆ ReadStream() [2/2]

edjx::stream::ReadStream::ReadStream ( uint32_t  sd)
inline

Constructs a new initilized Read Stream object.

Parameters
sdStream descriptor

Member Function Documentation

◆ pipe_to()

edjx::error::StreamError edjx::stream::ReadStream::pipe_to ( WriteStream write_stream)

Pipes a read stream into a write stream.

After all data is transmitted, both streams are automatically closed.

Parameters
write_streamWrite stream to which data from the read stream will be sent.
Returns
Returns edjx::error::StreamError::Success on success, some other value on failure.

◆ read_all()

edjx::error::StreamError edjx::stream::ReadStream::read_all ( std::vector< uint8_t > &  result)

Reads and returns all data from the stream until the end of stream.

This method does not close the stream.

Parameters
resultAll data received from the read stream will be copied here
Returns
Returns edjx::error::StreamError::Success on success, some other value on failure.

◆ read_chunk()

edjx::error::StreamError edjx::stream::ReadStream::read_chunk ( std::vector< uint8_t > &  result)

Read a chunk of binary data from the stream.

Parameters
resultThe received chunk of binary data
Returns
Returns edjx::error::StreamError::Success on success, some other value on failure.

The documentation for this class was generated from the following file: