A Stream that operates on DataBlocks in memory.
More...
#include <yateclass.h>
A Stream that operates on DataBlocks in memory.
An implementation of a Stream that reads and writes data in a DataBlock
◆ MemoryStream() [1/2]
Constructor of an empty stream
◆ MemoryStream() [2/2]
Constructor of aan initialized stream
- Parameters
-
data | Initial data to be copied in the memory stream |
◆ data()
◆ length()
virtual int64_t length |
( |
| ) |
|
|
inlinevirtual |
Get the length of the stream
- Returns
- Length of the DataBlock in memory
Reimplemented from Stream.
◆ readData()
virtual int readData |
( |
void * | buffer, |
|
|
int | len ) |
|
virtual |
Get data from internal DataBlock, advance pointer
- Parameters
-
buffer | Buffer for getting the data |
len | Length of the buffer |
- Returns
- Number of bytes read, negative on error, zero on end of data
Implements Stream.
◆ seek()
virtual int64_t seek |
( |
SeekPos | pos, |
|
|
int64_t | offset = 0 ) |
|
virtual |
Set the read/write pointer
- Parameters
-
pos | The seek start as enumeration |
offset | The number of bytes to move the pointer from starting position |
- Returns
- The new position of the stream read/write pointer. Negative on failure
Reimplemented from Stream.
◆ terminate()
virtual bool terminate |
( |
| ) |
|
|
inlinevirtual |
Do-nothing termination handler
- Returns
- True to signal the stream was closed
Implements Stream.
◆ valid()
virtual bool valid |
( |
| ) |
const |
|
inlinevirtual |
Do-nothing validity check
- Returns
- True to indicate the stream is valid
Implements Stream.
◆ writeData()
virtual int writeData |
( |
const void * | buffer, |
|
|
int | len ) |
|
virtual |
Write new data to the DataBlock at current position, advance pointer
- Parameters
-
buffer | Buffer of source data |
len | Length of data to be written |
- Returns
- Number of bytes written, negative on error
Implements Stream.
◆ m_data
◆ m_offset
The current position for read/write operation
The documentation for this class was generated from the following file: