AVBlocks for C++
3.0
Audio and Video Software Development Kit
|
The Stream interface can be used to implement a data source or sink. More...
#include <stream.h>
Public Member Functions | |
~Stream () | |
Empty destructor. | |
virtual bool_t | canRead () const =0 |
Checks whether the stream supports reading. | |
virtual bool_t | canSeek () const =0 |
Checks whether the stream supports seeking. | |
virtual bool_t | canWrite () const =0 |
Checks whether the stream supports writing. | |
virtual void | close ()=0 |
Closes the stream. | |
virtual bool_t | isOpen () const =0 |
Checks whether the stream is open. | |
virtual bool_t | open ()=0 |
Opens the stream. | |
virtual int64_t | position () const =0 |
Returns the current position in the stream. | |
virtual bool_t | read (void *buffer, int32_t bufferSize, int32_t *totalRead)=0 |
Reads data from the stream. | |
int32_t | release () const |
The default implementation keeps a constant reference count of 1. | |
int32_t | retain () const |
The default implementation keeps a constant reference count of 1. | |
int32_t | retainCount () const |
The default implementation keeps a constant reference count of 1. | |
virtual bool_t | seek (int64_t position)=0 |
Seeks to the specified position in the stream. | |
virtual int64_t | size () const =0 |
Returns the current size of the stream. | |
virtual bool_t | write (const void *buffer, int32_t dataSize)=0 |
Writes data to the stream. | |
virtual int32_t | release () const =0 |
Releases the instance. | |
virtual int32_t | retain () const =0 |
Retains the instance. | |
virtual int32_t | retainCount () const =0 |
Returns the current reference count. | |
The Stream interface can be used to implement a data source or sink.
It can be used as an alternative to files when it is not convenient or possible to use files.
The default implementation of primo::Reference keeps a constant reference count of 1. This can be used when the client code is the sole owner of the implemented stream and does not need to manage it through the primo::Reference interface.
|
pure virtual |
Checks whether the stream supports reading.
|
pure virtual |
Checks whether the stream supports seeking.
|
pure virtual |
Checks whether the stream supports writing.
|
pure virtual |
Checks whether the stream is open.
|
pure virtual |
Opens the stream.
|
pure virtual |
Returns the current position in the stream.
|
pure virtual |
Reads data from the stream.
buffer | [in] A pointer to the buffer where the data shall be stored. |
bufferSize | [in] Buffer size in bytes. Specifies how many bytes shall be read from the stream. |
totalRead | [out] A pointer to a variable that stores the actual number of bytes read from the stream. When the number of bytes returned (totalRead) is 0 then this is considered to be the end of the stream (EOS). Reading at the end of the stream succeeds but 0 bytes are returned. The number of bytes returned (totalRead) may be less than the requested bytes (bufferSize) even before the end of the stream is reached. |
|
virtual |
|
virtual |
|
virtual |
|
pure virtual |
Seeks to the specified position in the stream.
position | [in] Specifies the absolute position from the beginning of the stream (which is at position 0). |
|
pure virtual |
Returns the current size of the stream.
|
pure virtual |
Writes data to the stream.
buffer | [in] A pointer to the data that shall be written to the stream. |
dataSize | [in] Specifies how many bytes to write. |