AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
Loading...
Searching...
No Matches
AudioDataLib::ReadOnlyBufferStream Class Reference

This is a stream that can be used to read bytes from any location in memory. More...

#include <ByteStream.h>

Inheritance diagram for AudioDataLib::ReadOnlyBufferStream:
AudioDataLib::ByteStream

Public Member Functions

 ReadOnlyBufferStream (const uint8_t *buffer, uint64_t bufferSize)
 
virtual ~ReadOnlyBufferStream ()
 
virtual uint64_t WriteBytesToStream (const uint8_t *buffer, uint64_t bufferSize) override
 
virtual uint64_t ReadBytesFromStream (uint8_t *buffer, uint64_t bufferSize) override
 
virtual uint64_t PeekBytesFromStream (uint8_t *buffer, uint64_t bufferSize) override
 
virtual uint64_t GetSize () const override
 
virtual bool CanRead () override
 
virtual bool CanWrite () override
 
uint64_t GetReadOffset () const
 
bool SetReadOffset (uint64_t readOffset)
 
const uint8_t * GetBuffer () const
 
void Reset ()
 
- Public Member Functions inherited from AudioDataLib::ByteStream
 ByteStream ()
 
virtual ~ByteStream ()
 
template<typename T >
bool ReadType (T *value)
 
template<typename T >
bool WriteType (const T *value)
 

Protected Attributes

const uint8_t * readOnlyBuffer
 
uint64_t readOnlyBufferSize
 
uint64_t readOffset
 

Detailed Description

This is a stream that can be used to read bytes from any location in memory.

Constructor & Destructor Documentation

◆ ReadOnlyBufferStream()

ReadOnlyBufferStream::ReadOnlyBufferStream ( const uint8_t * buffer,
uint64_t bufferSize )

◆ ~ReadOnlyBufferStream()

ReadOnlyBufferStream::~ReadOnlyBufferStream ( )
virtual

Member Function Documentation

◆ CanRead()

bool ReadOnlyBufferStream::CanRead ( )
overridevirtual

Indicate whether there is data available to be read from the stream.

Implements AudioDataLib::ByteStream.

◆ CanWrite()

bool ReadOnlyBufferStream::CanWrite ( )
overridevirtual

Indicate whether it is possible to write additional data to the stream.

Implements AudioDataLib::ByteStream.

◆ GetBuffer()

const uint8_t * AudioDataLib::ReadOnlyBufferStream::GetBuffer ( ) const
inline

◆ GetReadOffset()

uint64_t AudioDataLib::ReadOnlyBufferStream::GetReadOffset ( ) const
inline

◆ GetSize()

uint64_t ReadOnlyBufferStream::GetSize ( ) const
overridevirtual

Return the amount of data (in bytes) currently stored in the stream.

Implements AudioDataLib::ByteStream.

◆ PeekBytesFromStream()

uint64_t ReadOnlyBufferStream::PeekBytesFromStream ( uint8_t * buffer,
uint64_t bufferSize )
overridevirtual

Read from this stream into the given buffer, but unlike ReadBytesFromStream, do not modify the stream. That is, a subsequent read from the stream will read from the same location.

Parameters
[out]bufferThis is a pointer to an array where bytes read from the stream will be written.
[in]bufferSizeThis is the size in bytes of the given array.
Returns
The number of bytes actually read from the stream and written to the given buffer is returned.

Reimplemented from AudioDataLib::ByteStream.

◆ ReadBytesFromStream()

uint64_t ReadOnlyBufferStream::ReadBytesFromStream ( uint8_t * buffer,
uint64_t bufferSize )
overridevirtual

Read from this stream into the given buffer.

Parameters
[out]bufferThis is a pointer to an array where bytes read from the stream will be written.
[in]bufferSizeThis is the size in bytes of the given array.
Returns
The number of bytes actually read from the stream and written to the given buffer is returned.

Implements AudioDataLib::ByteStream.

◆ Reset()

void ReadOnlyBufferStream::Reset ( )

◆ SetReadOffset()

bool ReadOnlyBufferStream::SetReadOffset ( uint64_t readOffset)

◆ WriteBytesToStream()

uint64_t ReadOnlyBufferStream::WriteBytesToStream ( const uint8_t * buffer,
uint64_t bufferSize )
overridevirtual

Write the given buffer to this stream.

Parameters
[in]bufferThis is a pointer to the array of bytes to write to the stream.
[in]bufferSizeThis is the size of the given array in bytes.
Returns
The number of bytes actually written to the stream is returned.

Implements AudioDataLib::ByteStream.

Member Data Documentation

◆ readOffset

uint64_t AudioDataLib::ReadOnlyBufferStream::readOffset
protected

◆ readOnlyBuffer

const uint8_t* AudioDataLib::ReadOnlyBufferStream::readOnlyBuffer
protected

◆ readOnlyBufferSize

uint64_t AudioDataLib::ReadOnlyBufferStream::readOnlyBufferSize
protected

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