Skip to content

class flake::Stream ​

Byte-oriented read/write stream associated with an Object property. More...

#include <platform/flake/Object.h>

Public Functions ​

Name
Stream(const Stream & ) =deleted
Stream &operator=(const Stream & ) =deleted
Stream(Stream && ) =deleted
Stream &operator=(Stream && ) =deleted
virtual intwrite(uint8_t data[], unsigned int len) =0
Write data into the stream.
virtual intread(uint8_t * data, unsigned int * len, unsigned int max_len) =0
Read data from the stream.
virtual intseek(unsigned int pos) =0
Seek to an absolute position in the stream.
virtual unsigned intpos() =0
Current read/write position in the stream.
virtual intclose() =0
Close the stream and release associated resources.
virtual uint32_tstreamId() =0
Unique identifier of this stream.

Protected Functions ​

Name
Stream() =default
~Stream() =default

Public Attributes ​

Name
constexpr uint8_tFLAG_LIVE
Flag: the stream is live (data is pushed as it arrives).

Detailed Description ​

cpp
class flake::Stream;

Byte-oriented read/write stream associated with an Object property.

Note: Non-copyable, non-movable.

Open a stream via Object::openProperty() on a property whose tag type is TT_STRING_STREAM or TT_BIN_STREAM.

Public Functions Documentation ​

function Stream ​

cpp
Stream(
    const Stream & 
) =deleted

function operator= ​

cpp
Stream & operator=(
    const Stream & 
) =deleted

function Stream ​

cpp
Stream(
    Stream && 
) =deleted

function operator= ​

cpp
Stream & operator=(
    Stream && 
) =deleted

function write ​

cpp
virtual int write(
    uint8_t data[],
    unsigned int len
) =0

Write data into the stream.

Parameters:

  • data Buffer containing the bytes to write.
  • len Number of bytes to write.

Return: E_OK on success, or a negative error code.

function read ​

cpp
virtual int read(
    uint8_t * data,
    unsigned int * len,
    unsigned int max_len
) =0

Read data from the stream.

Parameters:

  • data Destination buffer.
  • len Receives the number of bytes actually read.
  • max_len Capacity of data in bytes.

Return: E_OK on success, E_EOF at end of stream, or a negative error code.

function seek ​

cpp
virtual int seek(
    unsigned int pos
) =0

Seek to an absolute position in the stream.

Parameters:

  • pos Target byte offset from the beginning of the stream.

Return: E_OK on success, or a negative error code.

function pos ​

cpp
virtual unsigned int pos() =0

Current read/write position in the stream.

Return: Byte offset from the beginning.

function close ​

cpp
virtual int close() =0

Close the stream and release associated resources.

Return: E_OK on success, or a negative error code.

function streamId ​

cpp
virtual uint32_t streamId() =0

Unique identifier of this stream.

Return: The stream ID.

Protected Functions Documentation ​

function Stream ​

cpp
Stream() =default

function ~Stream ​

cpp
~Stream() =default

Public Attributes Documentation ​

variable FLAG_LIVE ​

cpp
static constexpr uint8_t flake::Stream::FLAG_LIVE

Flag: the stream is live (data is pushed as it arrives).