AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
IInputStream Class Referenceabstract

Represents an input stream.

#include <AUI/IO/IInputStream.h>

Public Member Functions#

virtual size_t read (char *dst, size_t size)=0
 Reads up to size bytes from stream. Blocking (waiting for new data) is allowed.
 
size_t read (std::span< std::byte > destination)
 Reads up to destination.size() bytes from stream. Blocking (waiting for new data) is allowed.
 
void readExact (char *dst, size_t size)
 Reads exact size bytes from stream. Blocking (waiting for new data) is allowed.
 
template<typename T>
deserialize ()
 
template<typename T>
IInputStreamoperator>> (T &dst)
 
template<typename T>
IInputStreamoperator>> (T &&dst)
 

Member Function Documentation#

◆ deserialize()#

template<typename T>
T IInputStream::deserialize ( )
inline

Reads data using AUI serialization (see AUI/Traits/serializable.h)

Returns
result value

◆ operator>>() [1/2]#

template<typename T>
IInputStream & IInputStream::operator>> ( T && dst)

Reads data using AUI serialization (see AUI/Traits/serializable.h)

Parameters
dstvalue to write

◆ operator>>() [2/2]#

template<typename T>
IInputStream & IInputStream::operator>> ( T & dst)

Reads data using AUI serialization (see AUI/Traits/serializable.h)

Parameters
dstvalue to write

◆ read() [1/2]#

virtual size_t IInputStream::read ( char * dst,
size_t size )
pure virtual
Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Parameters
dstdestination buffer
sizedestination buffer's size. > 0
Returns
number of read bytes (including 0)

Implemented in AByteBufferInputStream, AConcatInputStream, ADynamicPipe, AFileInputStream, ALimitedInputStream, AOggSoundStream, AOpusSoundPipe, APipe, ARandomInputStream, ARawSoundStream, ASoundResampler, AStringStream, AStrongByteBufferInputStream, ATcpSocket, AVorbisSoundPipe, AWavSoundStream, Pipe, and PipeInputStream.

◆ read() [2/2]#

size_t IInputStream::read ( std::span< std::byte > destination)
inline
Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Parameters
destinationdestination buffer
Returns
number of read bytes (including 0)

◆ readExact()#

void IInputStream::readExact ( char * dst,
size_t size )
inline
Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Exceptions
ThrowsAEOFException when could not read EXACT size bytes.
Parameters
dstdestination buffer.
sizedestination buffer's size.