Skip to content

Class jac::InputStream

ClassList > jac > InputStream

Interface for a binary input stream.

  • #include <stream.h>

Inherited by the following classes: jac::Duplex

Public Functions

Type Name
virtual int get () = 0
Get a single byte from the stream.
virtual void onData (std::function< void(void)>) = 0
Register a callback to be called when data is available.
virtual size_t read (std::span< uint8_t > data) = 0
Read data from the stream.
virtual ~InputStream () = default

Public Functions Documentation

function get

Get a single byte from the stream.

virtual int jac::InputStream::get () = 0

Note:

This method should not block.

Returns:

The byte or -1 if no data is available

function onData

Register a callback to be called when data is available.

virtual void jac::InputStream::onData (
    std::function< void(void)>
) = 0

Note:

The callback will not be called in parallel.

Parameters:

  • onData the callback

function read

Read data from the stream.

virtual size_t jac::InputStream::read (
    std::span< uint8_t > data
) = 0

Note:

This method should not block.

Parameters:

  • data the buffer to read into

Returns:

The number of bytes read

function ~InputStream

virtual jac::InputStream::~InputStream () = default

The documentation for this class was generated from the following file src/jac/link/stream.h